Quantcast
Channel: General Windows Desktop Development Issues forum
Viewing all 6180 articles
Browse latest View live

How to change network location type from unidentified to private using c++ on windows 10

$
0
0

Hi

I have tried to connect my raspberry pi with windows 10.
After connecting it, the unidentified network is created on my windows 10 and it is a public network.
I'd like to change it to private.
If I change location type to private on the Local Security Policy, the problem will be solved.
But I'd like to do it using c++.
If you have any solutions, please guide me.
Looking forward to hearing from you.

Thanks


Remote Assistance application errors (Bad Image) when running application that uses hooks to inject DLL

$
0
0

After a Windows Update, our application that uses Windows hooks in order to provide analytics information about other applications began being reported as an error when injected into Windows Remote Assistance. The error with the title "msra.exe - Bad Image" states that the DLL "is either not designed to run on Windows or it contains an error".

I was also able to reproduce the issue just creating a trivial application that does little more than register a hook callback using SetWindowsHookEx() and log the event. After some experimenting, I discovered that the error only occurred on a recent version of Windows 10 and only when the hooking application was ran with elevated privileges.

Error occurs running example app in Windows 10.0.18363. I am able to run Windows Remote Assistance and the hook application injects the DLL without error in version 10.0.17763.

Currently we are having our customers work around the issue by having them disable extension points for the msra.exe application, but we are wanting a more permanent solution. Is this a defect introduced by a recent Windows update or has there been a security requirements change that is causing this error? If the later, what might we need to change in our hooks usage?


Thanks.

Where is avcaudio.sys?

$
0
0

I'm trying to connect an IEEE 1394a/FireWire/i.Link audio device (to be precise, a Sony LISSA hi-fi set) to my Windows 10 PC. I'm aware that IEEE 1394 isn't exactly state-of-the-art, but it's avery nice set, and I want to use it as an audio device.

The receiver (I haven't connected the CD player or MD deck yet) is recognised as two different devices by windows, but in the area reserved for devices that it doesn't know what to do with it. I'm suspecting because of the absence of avcaudio.sys.

According to the Microsoft documentation (which I cannot link to, on account of being a newbie), it should be part of Windows. But it isn't anywhere on my installation, nor can it be found on either of the Windows 7 installation media (32 and 64 bits). There's avc.sys and avcstrm.sys, but no avcaudio.sys.

Short of writing it myself (I've never done any Windows development, but I'm rather experienced, so how difficult can it be?), what are my options of locating this elusive driver?

Thanks!

To write the script xcopy to backup the files on daily basis with file history

$
0
0

Hi

I have a  source folder   

c:\myapp\text1.txt

c:\myapp\text2.txt

c:\myapp\text3.txt

c:\myapp\training\>training.doc and I am trying to backup into E:\myapp\> folder

When I take the backup and if  there is any change in the existing file on the folder E\myapp , the existing file should be moved to the folder E:\myapp\archive_230220\>text1.text and the oroiginal file should be copied on the same place in E drive . Simillarly if there is any change on the content in training.doc, the existing file should be moved to E:\myapp\training\archive_230220\>training.doc. And the original file should be replaced with existing file

Please can you help me with  suggested code  how to write the  xcopy  for backup of  the folder  c:\myapp.


polachan


to write the small backup program of entire file of a folder to another folder

$
0
0

Hi

I have a  source folder   

c:\myapp\text1.txt

c:\myapp\text2.txt

c:\myapp\text3.txt

c:\myapp\training\>training.doc 

Also I have the  another folder e:\BackupApp\> 

I want to copy all the files from source folder to target folder only if there  is any changes  from the source folder and if there is new files in the source folder. I short, I want to copy to target folder  only  new files and changed files from the source folder. But if we are overwritting any existing file in target folder , the previous files  should be moved to another folder 'Archive23022020' in e:\Backup.  to keep history  of the changed content of the files. So when we move the old file should be named as  <filename>_1, <filename_2> on the current date Archive folder. If there is no Archive+Currentdate folder , should be created  automatically before taking the backup. Please can you give the code  in powershell to take the backup



polachan



32-bit depth icons become visible/invisible while switching "extended"/”non-extended” multiple displays mode in windows7

$
0
0

32-bit depth Icons become invisible while connecting second display and choosing "Control Panel\Display\Change Display Settings\Multiple displays: extend these displays" setting.

I draw icons in my MFC\C++ Windows7 application using
::DrawIconEx( hDC, x, y, hIcon,W,H,NULL,NULL, DI_NORMAL) API function.
Handle of ICON in memory is passed from outside. The icon is drawn alright while it has less than 32-bit color depth.

Any ideas? Thanks in advance!

DirectX: MFC OnIdle limited to 60 fps

$
0
0

Hi guys ,

i have a very particular issue…

i have directx classes for rendering to a window. I have created a GUI with MFC c++ and integrated my DirectX classes with it. I am initialising on OnInitDialog function and then doing a rendering loop at OnIdle function. I have over ridden WindowProc function. It is a model dialog.

The problem is, irrespective of whatever the VSYNC state of my directx component is(i know the present flags of swap chain btw), i am always getting 60 fps frame rate. when i minimise the window the frame rates unlocks and becomes very high. On maximise again it again drops to 60 fps.

A picture control is my rendering area which is a frame.

rendering starts when user click on a button.

so how to unlock frame rate in MFC OnIdle.

 

win api resource file - CONTROL with float_wndclass

$
0
0
I have win api resource file which contains CONTROL with the following class: float_wndclass. I haven't any information about that class. Do you know any documentation which describes that class ? How it differs from EDITTEXT ?

winapi - DeferWindowPos and InvalidateRect

$
0
0
I have a main window which allows to display a child modal dialog. That dialog window is created based on the resource file using DialogBox function. It contains a few controls and a horizontal splitter which are repositioned/resized when handling WM_SIZE and WM_MOUSEMOVE messages. I use BeginDeferWindowPos, DeferWindowPos and EndDeferWindowPos functions. It looks like that everything is repainted correctly. Should I also call InvalidateRect after EndDeferWindowPos ? Is there any scenario where it may be necessary ? I don't handle WM_PAINT message.

Invoking webview's DomContentLoaded event in the view model

$
0
0

I'm having problems implementing the webView's DOMContentLoaded event within my view model. I want to execute the code on the web page after the DOMContentLoaded event. I read the documentation about the event here, https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.webview.domcontentloaded, however I'm having problems implementing it. Below is the code I currently have:

WebView webView = new WebView();
webView.Navigate(new Uri(url));
webView.DOMContentLoaded += DOMContentLoaded;
// event handling for dom content loaded
        public event TypedEventHandler<WebView, WebViewDOMContentLoadedEventArgs> DOMContentLoaded
        {

        }
^ This is from the documentation

Currently, it's giving me an error that says, "event property must have both add and remove accessors." I understand how to use events in the XAML because it's super easy and does most of the work for me, but since I'm using the webview in the view model (to scrape and get some information on a web page), I need to wait for the page to load and then do the scraping. How can I do that in the view model?

How to erase an already drawn line using GDI+ in Win32 C++ application?

$
0
0
Hello. My Win32 C++ application should, in real time, perform Delaunay triangulation and draw a triangulation mesh. To do this, I use the GDI+ graphics library and the DrawLine function from this library. At the end of the drawing, the triangulation check function is launched, which can remove some extra edges from the triangulation mesh. The number of such removed edges can reach, in some cases, of course, 1000 edges and more. My question is: How, in GDI+, to delete a previously drawn lines? Is it possible? I will be very grateful for your help.


How to launch 'Tablet PC setting' option in C++

$
0
0

Hi,

I have requirement to launch the 'Tablet PC Setting' option through Programatically using C++ i have tried the below things but not working as expected:
Rundll32.exe Shell32.dll,Control_RunDLL TabletPC.cpl,,{80F3F1D5-FECA-45F3-BC32-752C152E456E}
but it is opening Pen and Touch windows but i wanted to open 'Tablet PC Settings' window where i get the calibrate option.

And also i have tried : 

BOOL bResult = CreateProcess(_T("C:\\Program Files\\Common Files\\microsoft shared\\ink\\TabTip.exe"),
NULL, ......)  in this case it is not even opening anything. 

It would be great if someone helps me out.

Thanks,

32-bit depth icons become visible/invisible while switching "extended"/”non-extended” multiple displays mode in windows7

$
0
0

32-bit depth Icons become invisible while connecting second display and choosing "Control Panel\Display\Change Display Settings\Multiple displays: extend these displays" setting.

I draw icons in my MFC\C++ Windows7 application using
::DrawIconEx( hDC, x, y, hIcon,W,H,NULL,NULL, DI_NORMAL) API function.
Handle of ICON in memory is passed from outside. The icon is drawn alright while it has less than 32-bit color depth.

Any ideas? Thanks in advance!

Launching 64-bit application in C++

$
0
0

Hi,

I have an 64-bit exe which am trying to launch it through 32-bit application running on 64-bit Windows 10 OS.

Is any one have a solution to launch the 64-bit exe from 32-bit application using some CreateProcess()  API or any other way?

Thanks,

Configure EAP-TTLS-PAP user credentials using WlanSetProfileEapXmlUserData

$
0
0
Hi,

I'm currently working on an app that must connect automatically to WiFi networks without user interaction. I am trying to store EAPTTLS UserProperties credentials using WlanSetProfileEapXmlUserData.


While issuing WlanSetProfileEapXmlUserData I am getting the error 57893 
I am using the UserProperties.xml which is generated using EAP-TTLS-PAP UserProperties schema as below.

EAP-TTLS-PAP schema:
------------------------------------

<?xml version="1.0" encoding="utf-8"?>
<xs:schema
    targetNamespace="http://www.microsoft.com/provisioning/EapTtlsUserPropertiesV1"
    elementFormDefault="qualified"
    xmlns="http://www.microsoft.com/provisioning/EapTtlsUserPropertiesV1"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:baseEap="http://www.microsoft.com/provisioning/BaseEapUserPropertiesV1"
    version="1.0"
    >
    <xs:import
        namespace="http://www.microsoft.com/provisioning/BaseEapUserPropertiesV1"
        schemaLocation="BaseEapUserPropertiesV1.xsd"
        />
    <xs:element name="eapTtls" type="EapTtls"/>
    <xs:complexType name="EapTtls">
        <xs:complexContent>
            <xs:extension base="TtlsCred"/>
        </xs:complexContent>
    </xs:complexType>
    <xs:complexType name="TtlsCred">
        <xs:sequence>
            <xs:element name="Username" type="xs:string" minOccurs="0"/>
            <xs:element name="Password" type="xs:string" minOccurs="0"/>
            <xs:element ref="baseEap:Eap" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
</xs:schema>


Generates UserProperties.xml file
---------------------------------

<?xml version="1.0"?>
<EapHostUserCredentials xmlns="http://www.microsoft.com/provisioning/EapHostUserCredentials" xmlns:eapCommon="http://www.microsoft.com/provisioning/EapCommon" xmlns:baseEap="http://www.microsoft.com/provisioning/BaseEapMethodUserCredentials">
    <EapMethod>
    <eapCommon:Type>21</eapCommon:Type>
    <eapCommon:AuthorId>311</eapCommon:AuthorId>
  </EapMethod>
  <Credentials xmlns:eapUser="http://www.microsoft.com/provisioning/EapUserPropertiesV1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:baseEap="http://www.microsoft.com/provisioning/BaseEapUserPropertiesV1" xmlns:EapTtls="http://www.microsoft.com/provisioning/EapTtlsUserPropertiesV1">
    <baseEap:Eap>
      <baseEap:Type>21</baseEap:Type>
<baseEap:EapTtls xmlns="http://www.microsoft.com/provisioning/EapTtlsUserPropertiesV1">
     <EapTtls:TtlsCred>
          <Username>test@abc.com</Username>
          <Password>testABC</Password>
<baseEap:Eap xmlns="http://www.microsoft.com/provisioning/BaseEapUserPropertiesV1">
<Type>21</Type>
  </baseEap:Eap>
        </EapTtls:TtlsCred>
      </baseEap:EapTtls>
    </baseEap:Eap>
  </Credentials>
</EapHostUserCredentials>

When I try to use the WlanSetProfileEapXmlUserData function for a successful set profile using PEAP MSCHAPV2.
OS:Win10 64 bit.
Can any help with an sample to set user properties for EAP-TTLS-PAP.
Thanks in advance,
Srini

OpenProcess() does not work in a Command Prompt but works on PS and Debuggers

$
0
0

Hello please help me with this intriguing issue. This works in VS2019 debug/nondebug mode, works in WinDbg, works in Powershell but does not work in a Command  prompt. Please note all of them were invoked with Admin privileges. 13116 is a known process called as the vmwp.exe which actually is a running VM. I get the permission denied error. Why is it only for Command Prompt? I did try with OpenProcess(PROCESS_SET_INFORMATION, FALSE, pid) that did not work either. 

PS(admin mode): ==> Works fine

PS D:\work\sample\rdt\hello\x64\Debug> .\hello.exe
HandlePass: Handle = 00000000000000C4, Error: 0


Command Prompt(admin mode):  ==> Fails :(

D:\work\sample\rdt\hello\x64\Debug>hello.exe
HandlePass: Handle = 0000000000000000, Error: 5


void
HandlePass(HANDLE *PHandle) {
    UINT32 pid = 11316;
   *PHandle = OpenProcess(PROCESS_SET_INFORMATION, TRUE, pid);
    wprintf(L"HandlePass: Handle = %p, Error: %x\n", *PHandle, GetLastError());
}
void
__cdecl wmain(int argc, __in_ecount(argc) wchar_t* argv[])
{
    wstring str;
    HANDLE handle; 
    HandlePass(&handle);
    getchar();

}



WlanSetProfileEapXmlUserData function from wlanapi.dll works only on 32-bit.

$
0
0

Hello all,

I'm developing a WPF application which is a wrapper for Windows Wireless functionality.

I am trying to connect to an Eap-Peap-Mschapv2 wireless network.

When I'm trying to add the EAP Profile with WlanSetProfileEapXmlUserData function from wlanapi.dll, if my app is configured as Any-Cpu - without Prefer 32-bit, the WlanSetProfileEapXmlUserData method returns always error code  1206 (Profile Corrupted).

If I change the platform to Any-Cpu - Prefer 32-bit the WlanSetProfileEapXmlUserData works as expected.

WlanSetProfileEapXmlUserData is not supported on 64-bit or it's a known issue?

Below, I will add the profiles that we are generating:

WlanProfile

<WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1">  <name>TestMSCHAPV2</name>  <SSIDConfig>    <SSID>      <hex>546573744D53434841505632</hex>      <name>TestMSCHAPV2</name>    </SSID>    <nonBroadcast>false</nonBroadcast>  </SSIDConfig>  <connectionType>ESS</connectionType>  <connectionMode>auto</connectionMode>  <MSM>    <security>      <authEncryption>        <authentication>WPA2</authentication>        <encryption>AES</encryption>        <useOneX>true</useOneX>      </authEncryption>      <PMKCacheMode>enabled</PMKCacheMode>      <PMKCacheTTL>720</PMKCacheTTL>      <PMKCacheSize>128</PMKCacheSize>      <preAuthMode>disabled</preAuthMode>      <OneX xmlns="http://www.microsoft.com/networking/OneX/v1">        <cacheUserData>true</cacheUserData>        <authMode>user</authMode>        <EAPConfig>          <EapHostConfig xmlns="http://www.microsoft.com/provisioning/EapHostConfig">            <EapMethod>              <Type xmlns="http://www.microsoft.com/provisioning/EapCommon">25</Type>              <VendorId xmlns="http://www.microsoft.com/provisioning/EapCommon">0</VendorId>              <VendorType xmlns="http://www.microsoft.com/provisioning/EapCommon">0</VendorType>              <AuthorId xmlns="http://www.microsoft.com/provisioning/EapCommon">0</AuthorId>            </EapMethod>            <Config>              <Eap xmlns="http://www.microsoft.com/provisioning/BaseEapConnectionPropertiesV1">                <Type>25</Type>                <EapType xmlns="http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV1">                  <ServerValidation>                    <DisableUserPromptForServerValidation>false</DisableUserPromptForServerValidation>                    <ServerNames></ServerNames>                  </ServerValidation>                  <FastReconnect>false</FastReconnect>                  <InnerEapOptional>false</InnerEapOptional>                  <Eap xmlns="http://www.microsoft.com/provisioning/BaseEapConnectionPropertiesV1">                    <Type>26</Type>                    <EapType xmlns="http://www.microsoft.com/provisioning/MsChapV2ConnectionPropertiesV1">                      <UseWinLogonCredentials>false</UseWinLogonCredentials>                    </EapType>                  </Eap>                  <EnableQuarantineChecks>false</EnableQuarantineChecks>                  <RequireCryptoBinding>false</RequireCryptoBinding>                  <PeapExtensions>                    <PerformServerValidation xmlns="http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV2">false</PerformServerValidation>                    <AcceptServerName xmlns="http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV2">false</AcceptServerName>                    <PeapExtensionsV2 xmlns="http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV2">                      <AllowPromptingWhenServerCANotFound xmlns="http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV3">true</AllowPromptingWhenServerCANotFound>                    </PeapExtensionsV2>                  </PeapExtensions>                </EapType>              </Eap>            </Config>          </EapHostConfig>        </EAPConfig>      </OneX>    </security>  </MSM>  <MacRandomization xmlns="http://www.microsoft.com/networking/WLAN/profile/v3">    <enableRandomization>false</enableRandomization>    <randomizationSeed>443648013</randomizationSeed>  </MacRandomization></WLANProfile>

Eap Profile

<?xml version="1.0" ?><EapHostUserCredentials xmlns="http://www.microsoft.com/provisioning/EapHostUserCredentials"                        xmlns:eapCommon="http://www.microsoft.com/provisioning/EapCommon"                        xmlns:baseEap="http://www.microsoft.com/provisioning/BaseEapMethodUserCredentials">  <EapMethod>    <eapCommon:Type>25</eapCommon:Type>    <eapCommon:AuthorId>0</eapCommon:AuthorId>  </EapMethod>  <Credentials xmlns:eapUser="http://www.microsoft.com/provisioning/EapUserPropertiesV1"               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"               xmlns:baseEap="http://www.microsoft.com/provisioning/BaseEapUserPropertiesV1"               xmlns:MsPeap="http://www.microsoft.com/provisioning/MsPeapUserPropertiesV1"               xmlns:MsChapV2="http://www.microsoft.com/provisioning/MsChapV2UserPropertiesV1">    <baseEap:Eap>      <baseEap:Type>25</baseEap:Type>      <MsPeap:EapType>        <MsPeap:RoutingIdentity>TestUsername</MsPeap:RoutingIdentity>        <baseEap:Eap>          <baseEap:Type>26</baseEap:Type>          <MsChapV2:EapType>            <MsChapV2:Username>TestUsername</MsChapV2:Username>            <MsChapV2:Password>TestPassword</MsChapV2:Password>            <MsChapV2:LogonDomain></MsChapV2:LogonDomain>          </MsChapV2:EapType>        </baseEap:Eap>      </MsPeap:EapType>    </baseEap:Eap>  </Credentials></EapHostUserCredentials>

win api - list view styles

$
0
0

I use Windows 10 and Visual Studio 2017. Here is the basic look of the list view:

How can I achieve the following style ?

win api - detecting a list view column width change

$
0
0
Is there any way to detect when a list view column width is changed ? I haven't found any notification event in the documentation.

Win32 API GetMenu(HWND hWnd) is not working on MFC application from wizard

$
0
0

Hi,

1) I am creating new MFC application using the Visual Studio "Add New Project" Wizard.

2) I run the created application without any changes.

        Application has a main menu (File, Edit, View, Help).

3) When calling "GetMenu(HWND hWnd)" from another process, I get no menu.

It does works on other applications, like windows notepad.

* I use VS 2017 and 2008 - both same results. I tried MDI and SDI application - also the same.

This is my code.

#include <Windows.h>
#include <commctrl.h>
#include <stdio.h>

BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
{

	char class_name[80];
	char title[80];
	GetClassName(hwnd, class_name, sizeof(class_name));
	GetWindowText(hwnd, title, sizeof(title));
	HMENU hMenu = (HMENU)::GetMenu(hwnd);
	int nMenuCount = GetMenuItemCount(hMenu);
	if (nMenuCount > -1)
	{
		printf("Window title: %s\n", title);
		printf("Class name: %s\n", class_name);
		printf("Menu count is %d\n", nMenuCount);
		printf("--------------------------------------\n");
	}
	return TRUE;
}

int main(int cargs, char** args)
{
	EnumWindows(EnumWindowsProc, NULL);
	return 0;
}


It will show the list of several programs, e.g.:

------------------------------------

Window title: Untitled - Notepad
Class name: Notepad
Menu count is 5

----------------------------------

But the MFC sample - no.



Regards,

Moti Wertheimer

Product Engineer

Viewing all 6180 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>