|
Sorry to say this but I believe you are misunderstanding the use of environment variables.
Apart from the fact that the string you are using is wrong ( the variable already contains the drive letter and as already pointed out may contain spaces) do you know the call you are making with apply environment variable expansion?
I prefer not to leave things to chance by either calling,
ExpandEnvironmentStringsForUser - "http://msdn.microsoft.com/en-us/library/bb762275(VS.85).aspx"
or
SHGetFolderPath - "http://msdn.microsoft.com/en-us/library/bb762181(VS.85).aspx"
Alan
|
|
|
|
|
I am trying to build a application consists of four dialogs(Dialog A, dialog B, Dialog C and Dialog D).
In dialog A is you press next button it will go to dialog B, at dialog B if you press cancel button it will go back to dialog A. If next button of dialog B is clicked then it will proceed to dialog C and so on.
For the last dialog, Dialog D, if the Finish button is clicked, it will go back to dialog A.
How can I link all the dialogs to work in the sequence specified.
Should I add dialog B,C,D as custom dialog to dialog A?
In dialog A I wrote the code shown below.where is member variable of CtryDlg which declared as CBDlg type.
/*tryDlg.cpp*/
#include "BDlg.h"
void CtryDlg::OnNext()
{
int nRet = m_dBDlg.modal();
}
In dialog B,
void CBDlg::OnCancelB()
{
int nRet = 5;
EndDialog(nRet);
return;
}
But I keep getting Debug Assertion Failed error when the next button of Dialog A is clicked.
Can someone give me so suggestions?
Thanks.
|
|
|
|
|
|
If you can use Maximilien's suggestion, override CPropertyPage::OnWizardFinish() and return FALSE to keep the sheet open. Then call the sheet's SetActivePage() method.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Run it in an External Function:
{
label1:
DlgA dlga;
if(dlga.DoModal()==IDCANCEL)return;
label2:
DlgB dlgb;
if(dlgb.DoModal()==IDCANCEL)goto label1;
label3:
DlgC dlgc;
if(dlgc.DoModal()==IDCANCEL)goto label2;
etc..
}
Regards,
Bram van Kampen
|
|
|
|
|
I need to find out what version of windows is running - Vista/Win7/XP and then get a list of processes. So far, for the list of processes I've got this:
bool isRunning(std::string pName)
{
unsigned long aProcesses[1024], cbNeeded, cProcesses;
if(!EnumProcesses(aProcesses, sizeof(aProcesses), &cbNeeded))
return false;
cProcesses = cbNeeded / sizeof(unsigned long);
for(unsigned int i = 0; i < cProcesses; i++)
{
if(aProcesses[i] == 0)
continue;
HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, 0, aProcesses[i]);
char buffer[50];
GetModuleBaseName(hProcess, 0, buffer, 50);
CloseHandle(hProcess);
if(pName == std::string(buffer))
return true;
}
return false;
}
This is supposed to get a list of processes, then return true if process X is running. But in Windows 7 it never returns true. Developing cross platform code for windows machines is getting as bad as Linux now. I'm fairly new to windows coding and I'm finding it nightmarish.
Thanks in advance.
|
|
|
|
|
int_80 wrote: if(pName == std::string(buffer))
Have you set a breakpoint on this statement to see the value of pName and buffer ? Maybe it's an upper/lower case issue.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I made a test, on Windows 7 of your code. For some processes the OpenProcess call fails, reporting 5 ('Access denied') as GetLastError return value. For the remaining processes, it works fine (e.g. I can detect the notepad.exe process running).
BTW: while the documentation states that OpenProcess and GetModuleBaseName are provided by Kernel32.lib on Windows 7, I had to link instead with Psapi.lib in order to obtain the executable).
BTW2: I'm the administrator of the machine.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I want to draw a graph of x and y axes from the middle of the window as origin can
any body help me?
regards
|
|
|
|
|
What is your doubt about?
You've to handle the WM_PAINT message (or implement the OnPaint message handler , if you're using MFC ) in order to draw in your window client area, see, for instance: "Using the WM_PAINT Message".
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
let me use any CDC, I want to plot on x axis values in time for particular range say
a 10 sec duration and on y axis i want the magnitude which is read from a file.
thanks
|
|
|
|
|
Basically You have to do some scaling to map your values into window client area pixels. Once you've properly scaled points, is just a matter of calling, multiple times, the CDC::LineTo method. Have a look at wonderful Cédric article: "High-speed Charting Control".
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks for the nice comment
And by the way, congrats for a well deserved MVP award
|
|
|
|
|
Cedric Moonen wrote: Thanks for the nice comment
Well deserved, in my opinion.
Cedric Moonen wrote: nd by the way, congrats for a well deserved MVP award
Thank you, you'll be in for sure the next year, wife permetting...
And maybe I'll kicked off: there are so many clever guys answering in this forum.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
int i=-20;
unsigned j=10;
i+j=? And why?
I am a beginner to C. Thanks for reply first.
|
|
|
|
|
What has this to do with C? This is simple mathematics, and if you find this hard to understand, I doubt that you will find programming too easy. I would suggest you get a copy of a good C or C++ book and read it thoroughly.
MVP 2010 - are they mad?
|
|
|
|
|
Richard MacCutchan wrote: This is simple mathematics
it really isn't.
try it in a compiler.
|
|
|
|
|
Chris Losinger wrote: try it in a compiler.
int i = -20;
unsigned int j = 10;
int k = i + j;
answer is -10. However if I just print the value (i + j) it returns 4294967286 obviously an unsigned integer, so some interesting automatic casting going on. I stand corrected!
[edit]the answer is -10 of course![/edit]
MVP 2010 - are they mad?
modified on Friday, January 15, 2010 12:50 PM
|
|
|
|
|
I guess this should be correct: i + j = -20 + 10 = -10
|
|
|
|
|
I noticed the "Joke" icon. I give you a 5.
It is tricky so I think the original post is a pretty good beginner's question. My daughter asks "why" a lot. It's a learning process.
|
|
|
|
|
antionette wrote: int i=-20;
unsigned j=10;
Fine.
antionette wrote: i+j=?
The above doesn't compile.
antionette wrote: And why?
Because it is not a valid C statement.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
antionette wrote: i+j=?
that's actually a tricky question. there are a lot of (really strange and non-intuitive, IMO) rules about how mixed signed/unsigned math is done in C. and a lot of those rules depend on how your compiler interprets the standard, and which standard.
i've found that whenever i'm doing signed/unsigned arithmetic, it's best to cast everything to a signed value, then perform the arithmetic. if the result needs to be unsigned, then i range-check the value to make sure it's non-negative and small enough to fit the result.
in this case, the answer is a huge positive integer.
int i = -20;
unsigned j = 10;
__int64 k = i + j;
k = 4294967286
modified on Friday, January 15, 2010 11:22 AM
|
|
|
|
|
Good info - I think the general rule is: don't use unsigned numbers in calculations.
MVP 2010 - are they mad?
|
|
|
|
|
Richard MacCutchan wrote: Good info - I think the general rule is: don't use unsigned numbers in calculations.
Don't mix unsigned and signed numbers, without proper explicit casts, in calculations.
FFY.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I use custom draw in report view list controls to alternate the background colour of each row to make it easier to read. This works fine. I've just started an application which would benefit from using groups in list controls. Ok, didn't take too much effort to get this working. The only problem now though is that the row background colours don't alternate any more - I get the same colour together for some adjacent rows.
I have found that in group mode the index of each row no longer refers to the physical position on the screen, the index of each row can in fact be anything! [within the total number] So I can no longer use the index to work out which background colour each row should be.
For example, with 5 items in a group of 4 and a group of 1, when I load the data the indexes are 0, 1, 2, 3, 4. When I sort the first column in reverse order the indexes become 1, 2, 3, 4, 0. The more rows I have the more random it gets.
Any ideas how I can work out what is the visible index?
|
|
|
|