|
Hello,
I need to be able to get the Serial Nº of my hard disk in order to be able to make my programs to run only in the hard disk that I want them to.
I'm using this code:
DWORD dwNumSerie = 0;
UpdateData();
GetVolumeInformation((LPCTSTR)this->m_vedPath,NULL,0,&dwNumSerie,NULL,NULL,NULL,0);
this->m_vedNumSerie.Format("%d",dwNumSerie);
UpdateData(FALSE); How do I can be sure that the code works?
As a parameter I've written down a "\" (backslash only) in an editcontrol (m_vedPath variable is a CString linked to that EditCtrl).
Is that parameter right in order to get info. of the local HDD?
Thank you in advance.
NOTE:
I've received a - number in my laptop and a positive one in other PC.
|
|
|
|
|
Hi Joan,
The disk s/n is a DWORD. For the path I use GetWindowsDirectory() and if that is a UNC I use "C:\". I also test whether GetVolumeInformation() succeeds, which you should always do when calling functions that return status information.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
i am programming in Visual C++.Net and i am working on a SDI project. i creat a Modeless Dialog box beside my document Window. and i have some button on this dialog box. i want to trap these Buttons events. So am using Event Handler and i creat a Function for one of the buttons in one of my Class to handle the Events of buttons (for example a function for BN_CLICKED on CMainFrame) but when i click on one of those Button nothing happend then(i set some Line BreakPoints on those Functions that created by Event handler, but they never Executed). i don't know why !
what is the reason ?
|
|
|
|
|
Add the event handlers in the appropriate class. In this case, it is the dialog box.
Kuphryn
|
|
|
|
|
my project name is Test.
i have to Trap Messages of that Button in CTestView.
do u mean that i can't do that ?
|
|
|
|
|
If you button is in a dialog, trap the button in your dialog class. If you want to trap the message in your main window, I am sure you can modify the command routing to deliver the message to your main window. How to do that? I don't know. I haven't use MFC in 4+ years.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Thanks for your answers. but how can i make a Connection between my Dialog button and my main Windows (CTestView). ? what can i do if i want to Trap BN_CLICKED of a butoon on a Dialog in my CTestView ?
|
|
|
|
|
when the button gets clicked in the dialog send a message to the main app and process it there ... use some custom message id's and u'll be fine
"traffic lights are for people who can't make their own decisions" biz stuff about me
|
|
|
|
|
void CMyDialog::OnBnClickedButton1() {
CTestView *e=new CTestView();
e->SendMessage(WM_MBUTTONUP, 0, 0);
}
it's not work what can i do ?
|
|
|
|
|
no no no
define some custom message id's (see msn) and send a custom message to ur app class and add a handler there for the message
"traffic lights are for people who can't make their own decisions" biz stuff about me
|
|
|
|
|
What event (or message or function call) does my MFC application/dialog will get when user presses WINDOWS-KEY + M ( the one that we use to minimize all windows ).
My Dialog based application does not get any notification and doesn't get minimized when I press WINDOWS-KEY+M
however I am able to minimize all windows (including my app) by pressing the "Show Desktop" quick link (which generally resides next to Start menu in the taskbar)
I want to rectify this problem with my app.
Please help me.
|
|
|
|
|
ummmmm isnt it the WM_SHOWWINDOW message?
"traffic lights are for people who can't make their own decisions" biz stuff about me
|
|
|
|
|
Wizard window says
WM_SHOWWINDOW: Indicates a window is about to be hidden or shown
So WM_SHOWWINDOW is when we call ShowWindow(nShowCmd) or any other similar things.
I am asking about window minimize.
I have done a weird thing for the window not to get minimized by default (ie without adding any code).
I removed the minimize button & title bar of the dialog.
Since I am doing all that title bar stuff on my own, I want to add this functionality too.
Please help me.
|
|
|
|
|
afaik all window stuff to do with min and max and whatnot gets done thru the SW_SHOWWINDOW message
"traffic lights are for people who can't make their own decisions" biz stuff about me
|
|
|
|
|
For message related issues, the best tool to use is Spy++, which comes with Visual C++. I just tried it and I got a message number 0x0127 (unknown) for Windows+M. You may wanna look into it further.
One thing to note however, is that Windows+M works fine with a dialog-based app I have here. Is there something special about yours?
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
hello @all,
i need an instruction which waits until MATLAB will finish it's job.
earlier forum question:
hello @all,
i try to explain what i want / must do :
i have something like this:
i=0;<br />
while(i<5)<br />
{<br />
i++;<br />
}<br />
the only problem is the while loop. without these, the program part runs perfectly. however i need a while loop or something like that.
i think, the problem lie in the fact that the program sends the data to matlab and then directly in the code continues to go. possibly different processes run off parallel.
i think i must have something that waits so long, till matlab is ready with the diagram (i tried Sleep(1000) but it do not work).
maybe somebody know, if matlab has got a 'instruction' or if i can make something like a 'queue'.
thank you very much
happy
|
|
|
|
|
Donno how ure doing it but take a look at the code on
http://www.codeproject.com/com/matlabengine.asp
and http://www.mathworks.com/access/helpdesk/help/pdf_doc/matlab/apiext.pdf
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
thanks for reply.
cool idea with the first url.
but the second link is 'broken', or??
sunny
|
|
|
|
|
my error. Everything is correct. super, thank you.
sunny
|
|
|
|
|
Hi!
I develop my own application using Visual C++. I need to get a directory where my application is launched.
I've found in MSDN two function: GetCurrentDirectory and GetModuleFileName. It seems that both methods are shown the right results (except for GetModuleFileName I need to make ReverseFind the first slash - but it's not hard to do). What method is the best ?
Yours sincerely,
Alex Bash
|
|
|
|
|
I strongly recommend you to use GetModuleFileName , this will give you the correct result. Be careful with GetCurrentDirectory , this will return the path your app is currently working in. E.g. if you create a file in "C:\Windows", this will be the current directory, regardless of whether your app is located there or not.
regards
Greg
modified 12-Sep-18 21:01pm.
|
|
|
|
|
At the first state of application (I don't perform any creating of files) - do GetModuleFileName and GetCurrentDirectory show the same results ?
Yours sincerely,
Alex Bash
|
|
|
|
|
They can, but need not.
Example:
Create a shortcut to your program.
Modify the shortcut and specify a different directory for the working directory.
Run the program using the shortcut.
When you do this, those API routines will return two different things.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
To be honest: I don't know. But I assume that if you call GetCurrentDirectory dierctly after startup it will return the path where your app is located. But I still think it is safer to use GetModuleFileName.
/edit: Tim is right
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
When I rotate a transparent bitmap, the transparent background color will be drawn around the bitmap (a one pixel halo). This doesn't happen when the rotation is horizontal or vertical. I am doing the following masking:
BitBlt( hScreenDC, r.left, r.top, curWidth, curHeight, hMemoryDC, 0, 0, SRCINVERT );
BitBlt( hScreenDC, r.left, r.top, curWidth, curHeight, hMaskDC, 0, 0, SRCAND );
BitBlt( hScreenDC, r.left, r.top, curWidth, curHeight, hMemoryDC, 0, 0, SRCINVERT );
At this point I have no clue as to why something like this would occur, because I have rotated the whole bitmap and saved it into the DC's. Has this happened to anyone before?
Thanks!
|
|
|
|