|
You should be able to just call %userprofile%\desktop without having the c:\ at the front. if you open your command prompt and type in %userprofile% it'll then give you an error message but it will expand the %userprofile% to it's actual value.
Hope that helps
|
|
|
|
|
CoderGirl42 wrote: ...but it will expand the %userprofile% to it's actual value.
Unless it contains spaces.
"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 see the expansion in which you are speaking of from the cmd window. However, since %userprofile% yields the msg. "...' is not recognized as an internal or external command, operable program or batch file.", I'm wondering if this is the same reason %userprofile% does not work from within my program. I'm beginning to think it's the vista platform
|
|
|
|
|
Yes, I've tried various forms... e.g. without c:\ without success...
|
|
|
|
|
Maybe stupid but if you open a DOS-window and type in SET (enter) is your userprofile there?
Rozis
|
|
|
|
|
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.
|
|
|
|