|
Syouki_kou wrote: when user click eject, it will get into my code
WM_DEVICECHANGE should help you.
Nibu thomas
Software Developer
|
|
|
|
|
It seems to be impossible. How I told you before: every application can use its own ID for the eject command. The usage of a command is hard encoded in its program-code. Therefore its no way to find out which command executes the eject function.
The other post told you about the WM_DEVICECHANGE message - but this is only a notification message broadcasting to all toplevel windows. This message informs all windows that a device has been changed (see Windows-SDK for help).
I've just tested the WM_DEVICECHANGE: the message is called after the media has been removed.
#include <DBT.H><br />
void CFrame::WmDeviceChange(WPARAM w,LPARAM l)<br />
{<br />
switch(w)<br />
{<br />
case DBT_CONFIGCHANGECANCELED:<br />
break;<br />
case DBT_CONFIGCHANGED:<br />
break;<br />
case DBT_DEVICEARRIVAL:<br />
break;<br />
case DBT_DEVICEQUERYREMOVE:<br />
break;<br />
case DBT_DEVICEQUERYREMOVEFAILED:<br />
break;<br />
case DBT_DEVICEREMOVECOMPLETE:<br />
break;<br />
case DBT_DEVICEREMOVEPENDING:<br />
break;<br />
case DBT_DEVICETYPESPECIFIC:<br />
break;<br />
case DBT_USERDEFINED:<br />
break;<br />
default:<br />
TRACE("WmDeviceChange: 0x%04X\r\n",w);<br />
break;<br />
}<br />
}
|
|
|
|
|
Thanks for all of your help!
My code is using shell programming! So all code are handled in this function:
HRESULT CXXXXXXXXX::QueryContextMenu ( HMENU hmenu, UINT uMenuIndex,
UINT uidFirstCmd, UINT uidLastCmd,
UINT uFlags )
I don't know how to associate the upper code with the message WM_DEVICECHANGE, could you help?
|
|
|
|
|
The Code only works if you have a toplevel window. You can create such a window by call:
<br />
LRESULT FAR PASCAL __WndProc(HWND h,int m,WPARAM w,LPARAM l)<br />
{<br />
switch(m)<br />
{<br />
case WM_DEVICECHANGE:<br />
break;<br />
}<br />
return DefWindowProc(h,m,w,l);<br />
}<br />
<br />
void AnyFunction()<br />
{<br />
WNDCLASS wc; memset(&wc,0,sizeof(wc));<br />
HWND hwnd=0;<br />
wc.lpfnWndProc = (WNDPROC)__WndProc; <br />
wc.hInstance = GetModuleHandle(); <br />
wc.lpszClassName = "catchDeviceMsg";<br />
if(RegisterClass(&wc))<br />
hwnd = CreateWindowEx(0,wc.lpszClassName,"",WS_OVERLAPPEDWINDOW,0,0,0,0,0,0,wc.hInstance,0);
}
|
|
|
|
|
Hi all.
I created an MS Windows application working with virtual COM-ports and an MSI-installer for it.
My problem is that you have to install the virtual port (com0com sourceforge-project) by hand using the System->Hardware->"Add new hardware" function. I'd like to find a way to add the "hardware" to the system with my installer with as few user-interaction as possible.
I tried "DPInst" from the MS DFIx framework for installing drivers, but failed. DPInst installed the driver to the system in a PnP-way, making it wait for the hardware to be plugged in (which apparently will never happen
If you install the driver by hand, it works instantly...
Suggestions, anyone?!
Kim
P.S. I'd be happy if someone had some information or sample code on how to use the SetupAPI (SetupDIxxx functions) to install NEW HARDWARE. Maybe that would solve my problem. Looking at the docs it seems like you can only install/update drivers with it...
-- modified at 6:28 Tuesday 28th February, 2006
|
|
|
|
|
I get link error LNK1209 no matter how many times i retry. The .pdb file is there and updated. I've even tried replacing the LINK.EXE, DUMPBIN.EXE, EDITBIN.EXE and LIB.EXE files in the VC98 bin folder (I'm using Visual Studio 6).
dahill
|
|
|
|
|
Did you try doing a "Rebuild All"? Doing that usually fixes things.
You may be right
I may be crazy
But it just may be a lunatic you’re looking for
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
Try a 'Full build' of your project.
A build or link error is not an error of your compiler! Dont replace your binary Visual Studio files.
|
|
|
|
|
Delete the 'Release' and 'Debug' folder and then perform a 'Rebuild All' on your application.
Hope this helps...
Vini
|
|
|
|
|
Thanks for the input gentlemen-
I have "rebuilt all" with no success. This link error reads, ".pdp differs from previous link; relink or rebuild" and (for me) only occurs in the DEBUG configuration.
-dahill
-- modified at 16:02 Tuesday 28th February, 2006
|
|
|
|
|
I have just found a similar LNK1209 problem posted in March, 2004 by "melwyn". Ominously, he didn't appear to get an answer (from the Message Board).
-dahill
-- modified at 17:36 Tuesday 28th February, 2006
|
|
|
|
|
Based on a solution attributed to "melwyn" on http://www.codecomments.com/archive307-2004-3-160471.html I was able to get rid of LNK1209.
I ended up using file version 6.0.8160.0 of MSPDB60.DLL in
C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin.
For some reason file version 6.20.9351.0 of mspdb60.dll cut from
C:\Program Files\Microsoft Visual Studio\VC98\Bin brought the link error with it.
-dahill
|
|
|
|
|
Hi again
I have a dialog box which has several buttons. In the background (behind the buttons) is a bitmap.
To reduce the size of the app, I would like to load the bitmap once the app has started (keeping it behind the buttons). I would also like to change the bitmap to a different one in response to events that occur in the program. How can I do this?
Thank you for any help
Mike
|
|
|
|
|
You can use LoadImage to load a bitmap, or GDI+ to load a jpg, etc. Then, you just draw it on the back of your dialog as you are now, and reload it according to your events, or store the base image path in a config file.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks Christian
I am now looking at using LoadImage - I am struggling to find an example of this though
Mike
|
|
|
|
|
MSDN has examples. However, loading bitmaps means storing bitmaps, which won't make your program smaller...
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks Christian,
The reason I want to do this is that the executable is running on a remote machine, which (if I do any alterations on the app) I will be updating over a telephone line. If the exe is large it can take for ever to download, hence trying to remove the bitmap from the file and storing it on the remote machine so I only have to download it the once.
Now, to look at the MSDN examples - Ive been away from my PC for a day or two!
Thanks again
Mike
|
|
|
|
|
Do you test WM_PAINT and CImage
the functions CImage are powerful for read and write files (bmp,jpg,png,...) and
in the class are functions for reduce size,...
|
|
|
|
|
does anyone have any ideas for creating a frameless MDI child
|
|
|
|
|
Remove the window styles (SetWindowLong(hwnd,GWL_STYLE,GetWindowLong(hwnd,GWL_STYLE)&~WS_BORDER);) for frames WS_BORDER, WS_DLGFRAME, WS_THICKFRAME etc. or call the CreateWindowEx() without these styles.
|
|
|
|
|
Hi,
I have an MFC application in which I take records from a table in one database (Let's say database A, table A), and insert them into a table in another database (Let's say database B, table B). This is a sort of "database conversion".
The thing is, that in database A the record numbers are not necessarily consecutive (for instance there could be records #1,2 and 4), But in database B the records are inserted to table B with an automatic record number.
For instance:
Table A (Database A) Table B (Database B)
-------------------- --------------------
record #1 ------------> record #1
record #2 ------------> record #2
record #4 ------------> record #3
My problem is that I need to save the record numbers of the records in database/table A, in order to use them later (for database relationship purposes).
(For instance - i need to know that record #3 in database B was actually record #4 in database A).
I used a CArray object to keep the indexes of the records of database/table A, but after I do the "database conversion" I need to use the indexes (of database A) in another application. how can I do this?
By the way, I am using C++ (and MFC) in .Net 2003.
|
|
|
|
|
Hi!
The guys over at the managed c++ board sent me looking for answers
to questions regarding standard c++ over here, so here goes.
How can i draw some sort of box (a border) in the console window?
Something like shown at: <ahref=""rel="nofollow">http://www.classicgaming.com/ascii/download_files/textworld/textworld.jpg[^]
A double border isn't necessary, I just want to know how to create such a border
with standard c++.
And how can I determine the size of the console screen (the DOS screen)
and set it so the user cannot change its size?
Thank in advance!
Regards,
Peter
P.S. if anyone tells me that this post doesn't belong on a Visual C++ board, then go yell
at the guys of the Managed C++ board since they sent me here.
|
|
|
|
|
Standard C++ has no support for GUI. You'll need to use a third-party library for that.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
Now that screenshot brings back fond memories.
Peter Charlesworth wrote: A double border isn't necessary, I just want to know how to create such a border
with standard c++.
Here's one example of drawing a box. Convert it to "standard C++" as per your definition.
printf("%c%c%c%c%c\n", 201, 205, 205, 205, 187);
printf("%c %c\n", 186, 186);
printf("%c%c%c%c%c\n", 200, 205, 205, 205, 188); Just make it as big as you need to. Also look at the console functions like SetConsoleCursorPosition() , WriteConsoleOutputCharacter() , and WriteConsole() .
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Thanks, David!
That's just what I needed.
Now I just have to fiddle around with it until I get how it works...
Regards,
Peter
|
|
|
|