|
Take a look at GetDriveType() .
|
|
|
|
|
Thank you, very much!
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
hello everybody
i used to do quite a lot of vc a few years
but got a job using another programing lauguage called PReS. (I bet nobody has heard of it)
is vc still the language to learn or would vb.net or c# or somthing else be better
which the most used language these days
jooooe
|
|
|
|
|
Jooooe wrote: is vc still the language to learn...
If you need to.
Jooooe wrote: which the most used language these days
How could anyone possibly know the answer to 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
|
|
|
|
|
If you ask in here you know you're going to get the answer VC++
After all you're not a soft headed newbie who need his memory managed for him are you? Seriously it all depends on what you want to do, how much control you want over how it's done and how quickly you want it done.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Jooooe wrote: which the most used language these days
www.tiobe.com keeps statistics on programming language search engine queries. As Mr. Crow stated, it is unlikely that this will be an accurate representation of what is used most as nobody could possibly know that, but it gives one a picture of how often a person resorts to a search engine query for a particluar language.
One could argue since MSDN is so thorough, that there will be fewer queries from users using Microsoft compilers which would indicate the statistics are probably less than accurate. One could also argue that the statistics merely indicate which languages require secondary assistance to get things done and could simply indicate a flawed help system for the leading compilers of that language.
Beware of buzzword fluctuations as they usually reflect the initial surge of queries to find out what a buzzword technology is. Those tend to taper off after the first year for newer technologies.
|
|
|
|
|
Hi,
This program is a dialog-based MFC application.
My problem is that when I click the "X" in the top right corner of the program to close it, only the window closes, but the process remains running.
I'm not very familiar with MFC (I usually use standard Windows API) so I don't know how to catch the WM_SYSCOMMAND message to handle this. I've tried ON_WM_SYSCOMMAND() in the message map, but I get a compiler error since neither of my two classes are inherited from CWnd objects (one is CWinApp, the other is CDialog).
Does anyone know why my program isn't closing, or how could I catch the WM_SYSCOMMAND message so I could force it to close?
Thanks!
KR
|
|
|
|
|
KellyR wrote: ...but the process remains running.
How are you verifying this? Have you created additional threads?
"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
|
|
|
|
|
The process is still visible in the task manager, and no I only have a single thread.
KR
|
|
|
|
|
How and where is the main dialog created?
BTW, CDialog IS a CWnd
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I thought so too but for some reason I still get a compiler error when I try to map ON_WM_SYSCOMMAND() in my dialog; I guess that's because the BEGIN_MESSAGE_MAP macro ties my class to CDialog and not CWnd? Sorry if I sound like an idiot, I'm just not that familiar with how MFC works. This is the first MFC application I've ever created from scratch so I'm still getting the hang of it.
The main dialog is created in the InitInstance() of the main application.
So something like this:
BOOL CTheApp::InitInstance()<br />
{<br />
CWinApp::InitInstance();<br />
m_MainDlg = new CMainAppDlg();<br />
<br />
if(!m_MainDlg->Create(IDD_MAIN_DIALOG))<br />
{<br />
AfxMessageBox(TEXT("Failed to initialize."), MB_OK, 0);<br />
return FALSE;<br />
}<br />
m_MainDlg->SetWindowText(TEXT("Test Dialog"));<br />
m_pMainWnd = m_MainDlg;<br />
<br />
return TRUE;<br />
}
KR
|
|
|
|
|
What's the compiler error when you add a ON_WM_SYSCOMMAND() entry to the dialog class'
message map?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
The error is this:
error C2440: 'static_cast' : cannot convert from 'void (__thiscall CMainAppDlg::* )(void)' to 'void (__thiscall CWnd::* )(UINT,LPARAM)'
KR
|
|
|
|
|
Your handler function needs to be declared as
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
From the error message it looks like you have void OnSysCommand();
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
|
I'm still not sure why the app isn't shutting down - I thought CWnd::OnNcDestroy() took
care of that if the window is the app's main window (designated by setting m_pMainWnd in
InitInstance()). Maybe debugging a breakpoint there will explain it.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Is this a dialog-based application? If so, then why are you creating a modeless dialog?
"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
|
|
|
|
|
You don't handle the [X] button with WM_SYSCOMMAND , you handle WM_CLOSE . More commonly, in a dialog-based app, you don't handle WM_CLOSE , but instead WM_COMMAND with a command ID of IDCANCEL . That way, your app will properly implement the three ways of closing a dialog: a button whose ID is IDCANCEL , the [X] button, and the Esc key.
|
|
|
|
|
Hello, I'm trying to allocate some memory but for some reason it keeps giving me a heap error. If I just continue through it in debug mode the function will output the proper number, and any time after that it continues to output numbers without and error, untill I restart visual studio then I get the error again. The error always occurs with h=2, any info on where to get start or how to fix this would be great.
const Complex I(0.0L,1.0L);
double **I = (double**)malloc(sizeof(double*)*K);
for ( h =0; h < K; h++){
I[h] = (double*) malloc(sizeof(double)*K);
}
Thanks
|
|
|
|
|
Since Complex is a class, you should probably be using new (and delete ).
simoncoul wrote: const Complex I(0.0L,1.0L); //imaginary numbers
double **I = (double**)malloc(sizeof(double*)*K);
So what is I ?
"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
|
|
|
|
|
This code was produced by someone else, but from my taking on it, it's just a 2D array with 1000 positions. I don't believe that I needs to be complex either, since it is being cast as a double, and no calculations are done with that involve it needing to be complex.
Thank you
|
|
|
|
|
But what is I ? How is the compiler not complaining about a re-definition?
"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 can't tell you why you're getting an erro on h == 2 but I would try something like this instead.
<br />
double** I = new double*[K];<br />
for( int h = 0; h < K; h++ )<br />
{<br />
I[h] = new double[K];<br />
}<br />
Obviously you'll need to do matching deletes, remember to use delete [] , array delete in case you every want to compile this on a non Microsoft system.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
I have tried what u said using new instead of malloc, but still when h = 2 in the loop I get an error.
Windows has triggered a breakpoint in kpSim.exe.
This may be due to a corruption of the heap, and indicates a bug in kpSim.exe or any of the DLLs it has loaded.
The output window may have more diagnostic information
and it causes the break in the free.c file.
Thanks
|
|
|
|
|
OK, the clue here is the break is in free.c . My guess from this is that code you posted or I posted is fine and the error is occuring in code I havn't seen yet. free.c is going to be doing a free, which needs changing to a delete, anyway. You need to track down what it is that's being freed and where this call originates from. If you can find the code with the free that is failing and changing it for a delete to match the new doesn't help, post it and I may be able to help. If I've left for the garage by then others will pick it up.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|