|
In vista 32 or 64?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
|
Somewhere in your data chain you havent the access rights for the USB-Device. Run your app as admin!
For the future you should use the right API for communicating with the USB-Drive. => File-API
Greetings from Germany
|
|
|
|
|
I have defined first GUID and handles, then using Readfile and Writefile for data read and write on USB. as shown below
GUID *guidDev = (GUID*) &GUID_CLASS_USBPORT;
HDEVINFO hDevInfo = INVALID_HANDLE_VALUE;
hDevInfo = SetupDiGetClassDevs( guidDev,
NULL,
NULL,
DIGCF_PRESENT | DIGCF_DEVICEINTERFACE
);
g_hw_USBWrite = CreateFile ( UsbWritePipe,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, // no SECURITY_ATTRIBUTES structure
OPEN_EXISTING, // No special create flags
0, // No special attributes
NULL); // No template file
g_hw_USBRead = CreateFile ( UsbReadPipe,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, // no SECURITY_ATTRIBUTES structure
OPEN_EXISTING, // No special create flags
0, // No special attributes
NULL); // No template file
These are some decleratios i do for access USB if something is wrong in it please tell me.
And if my API are wrong then how it work fine for Windows XP?
Waiting for reply?
thank you
|
|
|
|
|
You arent doing wrong BUT Microsoft had changed access right / managment in Vista. So check every call what can be wrong. -> Read the fine manuals online.
For instance in: g_hw_USBRead = CreateFile ( UsbReadPipe,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
Check every parameter / flag: in reading you dont NEED write rights. Is UsbReadPipe vaild?
That is all yor work.
Greetings from Germany
|
|
|
|
|
I have a excel file . I want to import in my gui application . my excel file cell has reference of other application . how can I import that data to my gui application
Trioum
|
|
|
|
|
Google for excell automation. This is a quite broad subject thought...
|
|
|
|
|
can you help me in this scenerio . some quick api . I want to connect excel file with by gui .
also that excel file is updating continously from some other application and cell is updation the value with some formulae
Trioum
|
|
|
|
|
|
Here is a semi-related example (the latter part of the article).
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I want to Hide the my command window using createprocess
i m using this like but not able to hide
PROCESS_INFORMATION pInfo;
STARTUPINFOA sInfo;
DWORD exitCode;
sInfo.cb = sizeof(STARTUPINFOA);
sInfo.lpReserved = NULL;
sInfo.lpReserved2 = NULL;
sInfo.cbReserved2 = 0;
sInfo.lpDesktop = NULL;
sInfo.lpTitle = NULL;
sInfo.dwFlags = 0;
sInfo.dwX = 0;
sInfo.dwY = 0;
sInfo.dwFillAttribute = 0;
sInfo.wShowWindow = SW_HIDE;
memset (&sInfo, 0, sizeof(sInfo));
sInfo.cb = sizeof(sInfo);
bool type = CreateProcess(NULL, cmdpath, NULL, NULL, FALSE, 0, NULL, NULL, &sInfo, &pInfo);
|
|
|
|
|
I'm a little rusty, but doesn't that memset completely clear the STARTUPINFOA structure?
|
|
|
|
|
now i remove
//memset (&sInfo, 0, sizeof(sInfo));
// sInfo.cb = sizeof(sInfo);
but it is not also work........
|
|
|
|
|
Why have you commented out the line which holds the size of sInfo?
|
|
|
|
|
Is this your command window or cmd if its cmd you can use of cmd/h.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
It is not cmd window
this is my copymovie.exe which i run through createprocess in my mfc application
|
|
|
|
|
Of course you have a way you can use of FindWindow for get hwnd to your window and then use of ::ShowWindow(hwnd,SW_HIDE);
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
You are shure that the windows isnt opened from the cmdpath?
Greetings from Germany
|
|
|
|
|
Your problem is in the Flags:
sInfo.dwFlags = STARTF_USESHOWWINDOW;
PROCESS_INFORMATION pInfo;
STARTUPINFOA sInfo;
sInfo.cb = sizeof(STARTUPINFOA);
sInfo.lpReserved = NULL;
sInfo.lpReserved2 = NULL;
sInfo.cbReserved2 = 0;
sInfo.lpDesktop = NULL;
sInfo.lpTitle = NULL;
sInfo.dwFlags = STARTF_USESHOWWINDOW;
sInfo.dwX = 0;
sInfo.dwY = 0;
sInfo.dwFillAttribute = 0;
sInfo.wShowWindow = SW_HIDE;
BOOL ret = ::CreateProcess(m_PathToExe, lpExePlusArgs, NULL, NULL, FALSE, 0, NULL, NULL, &sInfo, &pInfo);
if(ret)
{
WaitForSingleObject(pInfo.hProcess, INFINITE);
::CloseHandle(pInfo.hThread);
::CloseHandle(pInfo.hProcess);
}
Read MSDN carefully and with patience.
kostas KEL
|
|
|
|
|
MyApp.exe is working fine in debug mode but it is giving above error when i am trying to run in release mode.
In my application i have 1 button, when clicked(left click) on button, it shows popup menu and when i click on sub popup menu it displays 1 dialog, this dialog has 1 send button when clicked on send button my application sends message to other application and at the same time it will save that sent msg data to .xml file.
Thanks in advance
|
|
|
|
|
|
|
It is a common problem that Release builds are crashing while Debug runs. In Debug build are the buffers bigger, so it doesnt crash if you overwrite some bytes. You only got to find where the too small buffer is...
Greetings from Germany
|
|
|
|
|
Hi,
im using GetPrivateProfileString() to retrieve a value from a key of a particular section in INI file...
I want to know how many keys (along with their keynames) are there in the particular section of an INI file and one by one i need to read the values of those keys....
Please let me know...
|
|
|
|
|
pradeep455 wrote: I want to know how many keys (along with their keynames) are there in the particular section of an INI file and one by one i need to read the values of those keys....
You can use GetPrivateProfileString() for this.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|