|
i usually just pull the plug out
Yours Truly, The One and Only!
|
|
|
|
|
The ancient BorlandC++ - that I first made a program - have a set of functions to access low level structure of magnetic media:
biosdisk(), absread(), abswrite()
Are any equivalent in VisualC++6?
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
I've never heard of those, but judging by the description, I highly doubt there are any equivalents in VC++.
Windows Calculator told me I will die at 28.
|
|
|
|
|
I want to phisically format a writable device, such as floppy, usb drive, etc.
If Windows Calc told you that, you must be 30. Oh, by the way:
"If you date a girl that says she's 25 and looks 18, be sure she's 12." (I read this on a subway wall)
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
RomTibi wrote: Are any equivalent in VisualC++6?
Perhaps, but only if you wanted to write a device driver to do the low-level access. I think the HAL would restrict your access to the hardware.
What exactly are you trying to do (there may be a VC++ equivalent)?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I want to phisically format a writable device, such as floppy, usb drive, etc.
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
RomTibi wrote: I want to phisically format a writable device, such as floppy, usb drive, etc.
Can you use SHFormatDrive() for this?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I'll try!
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
You may want to look into the Windows APIs CreateFile() (see the section "Physical Disks and
Volumes") and DeviceIoControl(). Note that disk access at this level requires administrator
rights.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks, I;ll try that way!
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
I want to send a message to WindowProc() function of application from a static callback function.
The PostMessage() and SendMessage() functions makes "Unhandled Exception". Can anybody tell me how to make the PostMessage() call no error.
Best Regards,
Suman
-- modified at 2:39 Monday 23rd July, 2007
|
|
|
|
|
Try changing your code to look something like this:
BOOL CMyDlg::OnInitDialog()<br />
{<br />
CBaseClass::OnInitDialog();<br />
PostMessage(MY_MESSAGE,0,0);<br />
return TRUE;<br />
}
Note I have used Postmessage() rather than SendMessage()
-Randor (David Delaune)
|
|
|
|
|
Hi,
Thanks for your help.
The exception is happening if I call PostMessage() or SendMessage() from inside a static function(callback). If I call from somewhere else it is ok.
Best Regards,
Suman
|
|
|
|
|
Is the function a static 'member' function?
if not...
Have you tried the global namespace Postmessage?
::PostMessage(hwnd,msg,0,0);
Can you paste the error message here?
|
|
|
|
|
Hi,
If I use global namespace Postmessage, there is no error.
The runtime error message is as follows:
"Unhandled exception at 0x7c28e12a (mfc71d.dll) in MIDIApplication.exe: 0xC0000005: Access violation reading location 0x00000020."
The code causing the error is:
AfxGetMainWnd()->SendMessage(wMsg, 0, dwParam1); where wMsg is the message and dwParam1 is the LParam in argument list of static callback function: MidiInProc() .
Thanks for your help!!
Best Regards,
Suman
|
|
|
|
|
What is the result of the following (put before your code):
CWnd *pWnd = AfxGetMainWnd();
__asm int 3
When you run this code a breakpoint will be generated at the __asm int 3 line. Inspect the variable pWnd at this point. Is is NULL? If not what is its value?
Steve
|
|
|
|
|
Hi, pWnd is not NULL. The value is 0x0012ea24.
Is it possible to use DispatchMessage() to send message to WindowProc() .
What is difference between DispatchMessage and PostMessage() ?
Best Regards,
Suman
-- modified at 4:37 Monday 23rd July, 2007
|
|
|
|
|
DispatchMessage is used while implementing Message loop along with GetMessage. If you want to post a message into the message loop you need to use either PostMessage or SendMessage
"a child will grow up to become an adult, but you can never stop the adult from acting like a child"
|
|
|
|
|
Hello again,
I am happy that your issue has been resolved. But, so you can learn from this experience with others... let me explain my theory about what was happening.
You stated that you were calling AfxGetMainWnd() from within a callback function. Callbacks are often not excuting within the same thread as the main window. They may be called from an external thread.
From the MSDN: http://msdn2.microsoft.com/en-us/library/waas15s1(VS.80).aspx[^]
"If AfxGetMainWnd is called from the application's primary thread, it returns the application's main window according to the above rules. If the function is called from a secondary thread in the application, the function returns the main window associated with the thread that made the call."
Best Wishes,
-Randor (David Delaune)
|
|
|
|
|
Thank you very much for your great help!!
So, we should be careful when implementing callback!!
Thanks & Regards,
Suman
|
|
|
|
|
What kind of exception? From where is it being thrown? What does the code look like around the "throw" site? What are the parameters you're passing to the API? Is the HWND valid? In short we need some more detailed information.
Steve
|
|
|
|
|
Hi,
I can now send message using global namespace SendMessage().
Please see my reply to Mr. Randor above for the error details.
If you need other info please ask me.
Best Regards,
Suman
|
|
|
|
|
Can any one tell me what could be problem with following code ?
::CoInitialize(NULL);
m_rsocp.CreateInstance(__uuidof(Recordset));
m_rsocp->Open((LPCTSTR)str,(LPCTSTR)m_strConnection,adOpenDynamic,adLockOptimistic,adCmdUnknown);
if(FAILED(m_rsocp->QueryInterface(__uuidof(IADORecordBinding),(LPVOID*)&binding)))
_com_issue_error(E_NOINTERFACE);
adoctrl.m_UserId = tempuserid;
adoctrl.m_NewAccount = LArray[0];
adoctrl.m_InactivateAccount = LArray[1];
binding->AddNew(&adoctrl);
binding->Update(&adoctrl);
binding->BindToRecordset(&adoctrl);
m_rsocp->Close();
::CoUninitialize();
|| ART OF LIVING ||
|
|
|
|
|
1.) Is GetSystemDefaultLangID() the best way to detect which language version of the OS is running? Or GetUserDefaultLangID() ? Or something else?
2.) Is there a way to temporarily trick the US version of XP into thinking it's in another language? I tried changing the "Default input language" in the "Regional and Language Options" control panel, along with both GetSystemDefaultLangID() and GetUserDefaultLangID() in my code, but they both return English regardless of what I set for the default input language. Do I need localized installs of XP to test my localizations?
|
|
|
|
|
Do I need localized installs of XP to test my localizations?
No.
Instead you can change the language in
"Regional and Language Options" -> "Advanced" tab.
|
|
|
|