|
Hey all,
I'm trying to figure out how to directly write to a device in Windows. Basically, what I'm wanting to do is create an image of a device (specifically, a CompactFlash card that doesn't use a filesystem Windows recognises), store it as a file, modify it and dump it back to the card.
Currently, in version 0.001 of my program, I'm just calling dd for Windows using ShellExecute - this works perfectly, but obviously this isn't exactly acceptable for the final product! (and in the kludgy way I've done it, it locks the whole program and I can't implement a progress bar etc etc)
I'm HOPING it's as easy as using fopen and just treating it like a file from then on (sorry, that's my Unix background speaking)...
Any help would be much appreciated.
|
|
|
|
|
How can i stop and notify new device which isn't installed?
I have been programing following but it doesn't work...
Can somebody tell me how...please
following is my code:
==========================================================
BOOL CSPClientDlg::ConnexantStartStop(DWORD NewState)
{
// scan only Media-Classes
HDEVINFO hDevInfo = SetupDiGetClassDevs((LPGUID)&GUID_DEVCLASS_MEDIA, NULL,
NULL, DIGCF_PRESENT);
if (hDevInfo == INVALID_HANDLE_VALUE){
return FALSE;
}
SP_DEVINFO_DATA DeviceInfoData = {sizeof(SP_DEVINFO_DATA)};
DeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
BOOL bFound = FALSE;
for(int i=0; SetupDiEnumDeviceInfo(hDevInfo, i, &DeviceInfoData); i++){
DWORD DataT;
LPTSTR buffer = NULL;
DWORD buffersize = 0;
while (!SetupDiGetDeviceRegistryProperty(hDevInfo, &DeviceInfoData,SPDRP_DEVICEDESC,
&DataT, (PBYTE)buffer, buffersize, &buffersize)){
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER){
if (buffer){
LocalFree(buffer);
}
buffer = (LPTSTR)LocalAlloc(LPTR, buffersize);
}else{
return FALSE;
}
}
if(strcmp(buffer,"USB") == 0){
bFound = TRUE;
}
if(buffer){
LocalFree(buffer);
}
if(bFound == TRUE){
break;
}
}
if(bFound == TRUE){
// it can take some time...
CWaitCursor wait;
SP_PROPCHANGE_PARAMS PropChangeParams = {sizeof(SP_CLASSINSTALL_HEADER)};
PropChangeParams.ClassInstallHeader.cbSize =
sizeof(SP_CLASSINSTALL_HEADER);
PropChangeParams.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE;
PropChangeParams.Scope = DICS_FLAG_GLOBAL;
PropChangeParams.StateChange = NewState;
PropChangeParams.HwProfile = 0;
if (!SetupDiSetClassInstallParams(hDevInfo,&DeviceInfoData,
(SP_CLASSINSTALL_HEADER *)&PropChangeParams,sizeof(PropChangeParams))){
return FALSE;
}
if(!SetupDiChangeState(hDevInfo,&DeviceInfoData)){
return FALSE;
}
PropChangeParams.ClassInstallHeader.cbSize =sizeof(SP_CLASSINSTALL_HEADER);
PropChangeParams.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE;
PropChangeParams.Scope = DICS_FLAG_CONFIGSPECIFIC;
PropChangeParams.StateChange = NewState;
PropChangeParams.HwProfile = 0;
if (!SetupDiSetClassInstallParams(hDevInfo,&DeviceInfoData,
(SP_CLASSINSTALL_HEADER *)&PropChangeParams,sizeof(PropChangeParams))
||!SetupDiCallClassInstaller(DIF_PROPERTYCHANGE,hDevInfo,&DeviceInfoData)){
return FALSE;
}
if(!SetupDiChangeState(hDevInfo,&DeviceInfoData)){
return FALSE;
}
}
SetupDiDestroyDeviceInfoList(hDevInfo);
return bFound;
}
=====================================================
in this code, i want to stop only USBs...
Can someone help me to resolve this problem.thank you
Atsuki
|
|
|
|
|
hi !
I have a program written with MFC. I want it to retrieve some data from a mysql database that i have on my webserver. Can anyone tell me how to do this?
thanks
kane
"Some guys hack just to get themselves a girlfriend.What a pathetic reason huh ?"
http://www.coderkane.com
|
|
|
|
|
Have you looked into accessing it via ODBC using a CRecordset object?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
There is also MySQL++, the C++ wrapper for the MySQL C API, which is what I am using in my current project.
I don't know squat about MFC, but it works great with Win32s so I don't see any reason why you couldn't use it.
link to manual and other resources
http://dev.mysql.com/doc/plusplus/en/4_Tutorial.html[^]
Dave
|
|
|
|
|
If you have the data on your webserver I'm assuming you have apache and php running yes? If so you can write a very simple script on the server in php to return the data you want. From your mfc program you can "call" the script using the POST method (very simple - there are many classes here on cp that show you how to do that)
hth
|
|
|
|
|
hi,
i was trying to create irregular shaped figures on the desktop,i was able to do that in winnt using
HWND hwnd = ::FindWindow("Progman","Program Manager");
HRGN hrgn = createrectrgn(10,10,100,100);
::setwindowrgn(hwnd,rgn,TRUE);
& it worked fine ,but in the case of win98 the setwindowrgn always returns 0,so i changed the setwindowrgn to a MFC call it returns success but no desired results are seen.
And after all now iam confused over Createrectrgn about what it returns.It is said that it returns the handle to the region ,but is it region on the desktop or current.
I am really lost and confused.
any suggestions will be really helpful.
thanx in advance
regards
udaykumar
|
|
|
|
|
You should be able to get at the desktop window by calling GetDesktopWindow() or CWnd::GetDesktopWindow() . This should work across all (non-embedded) versions of Windows.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi guys
Long time ago, I had a problem to manage keyboard in a CFormview and I solved using accelerators.
Now I have another one.
When I open a dialog from the CFormview (the old one with accelerators) of my SDI app, I don't know how to manage the keyboard inside it. OnKeyDown doesnt't works.
There is a way to perform the same or similar accelerator's solution?
There is a way to have accelerators for each dialog that I open?
How can I do this?
Thanks in forwarding.
Doc
|
|
|
|
|
|
How can the sub item editing be handled for a list created at runtime.
laiju
|
|
|
|
|
push((v, (holder1<void* Class::*>){i->standard}));
I get the following compiler error:
<br />
error C2958: the left parenthesis '(' found at '\class\class.hpp(148)' was not matched correctly
|
|
|
|
|
I don't know why this forum software keeps stripping my code.. The following is hopefuly the code as I meant to post it originally:
<code>push((v, (holder1<void* Class::*>){i->standard}));</code>
|
|
|
|
|
I have to develop a product for Windows XP using VC++.Net with the following features:
1. It has a installer file. After running the installer file, a connection will be created in \My Network Places
2. Double click the connection, a dialog will be shown to type a username and password in. The typed username and password will be used to authenticate to connect to another computer using 802.1x
After authenticating, my computer will be connected to the other computer.
Any one know what steps I should do to implement this product? Does Windows XP provides API to create a connection with 802.1x authentication or I have to develop a 802.1x client?
I really need your advice.
Thank you very much
|
|
|
|
|
i use windows media sdk ....but i dont know how to get interface ....i want get IWMPMedia's Method ...teach me....
|
|
|
|
|
I am not a COM expert by any means, but you might find your answer in one of the articles at http://www.codeproject.com/com/#Beginners[^]
I do not know why people have voted your query down without answering it. If you don't know the answer, ignore the question. If the answer is so simple to you then give a pointer, don't vote the query down. Remember, the only stupid question is the one that is never asked.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
I'm using WinXP+sp2 and .NET 2003
when i compiled a cpp file including the following line:
#include "Winhttp.h"
however the compiler can not find the file "Winhttp.h".
where can I get it?
|
|
|
|
|
|
thanks ,i got it
|
|
|
|
|
I am having problems compiling an app that simply includes the following template definition, any idea why?:
<br />
template<> struct get<SQInteger> <br />
{<br />
inline static SQInteger from(HSQUIRRELVM v, int idx)<br />
{<br />
SQInteger p;<br />
if (SQ_FAILED( sq_getinteger (v, idx, &p) )) throw exception(v);<br />
return p; <br />
}<br />
};<br />
Here is the error I'm getting from VS.NET 2003
<br />
\primitives.hpp(18) : error C2143: syntax error : missing ';' before '<'<br />
\primitives.hpp(18) : error C2913: explicit specialization; 'squadd::types::get' is not a specialization of a class template<br />
\primitives.hpp(18) : error C2059: syntax error : '<'<br />
\primitives.hpp(19) : error C2143: syntax error : missing ';' before '{'<br />
\primitives.hpp(19) : error C2447: '{' : missing function header (old-style formal list?)<br />
|
|
|
|
|
Actually I pasted that in wrong, this is the specialization that is causing me problems:
template<> struct get<sqinteger>
{
inline static SQInteger from(HSQUIRRELVM v, int idx)
{
SQInteger p;
if (SQ_FAILED( sq_getinteger (v, idx, &p) )) throw exception(v);
return p;
}
};
|
|
|
|
|
A little more context is need to provide a sure answer, but I'll try my luck. I understand you're specializing a previously defined class template named get , right? If so, please check that the general definition of get is included before the specialization. Additionally, the syntax for a full specialization like yours (assumming you're specializing on HSQUIRRELVM ) is:
template<> get <HSQUIRRELVM>
{
...
} Does this help?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Want a Boost forum in Code Project? Vote here[^]!
|
|
|
|
|
Alright so, I have this server, but I want to know the IP address of the client BEFORE I accept the connection...I have a feeling I might need to gain this from the communications layer, but I don't know how, or if there is a winsock function that would help me with this...been trying to just find the damn thing for hours now. Someone please advise?
|
|
|
|
|
I think the client's address is present in the SOCKADDR passed to CAsyncSocket::Accept() . See this[^] MSDN link.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Unfortunately, I need the IP address before I make the accept call, the pointer passed to accept is used to store the ip address upon accepting the request. Also, I need to figure out how to simply ignore clients...that is if an IP address attempts to connect, I send them nothing, not even a SYN_ACK packet(which is what I assume accept does)
Using TCP/IP protocol btw.
|
|
|
|