|
Try...
TCHAR caFilenamem[ _MAX_PATH ];
int retval;
retval = GetModuleFileName(NULL, caFilenamem, _MAX_PATH); You were passing in an uninitialized pointer.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
miqel wrote: but how to get path to executable file in MFC application ??
The same way, actually, you'll just use __argv[0] instead. You also have access to the app's m_lpCmdLine member.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
|
|
|
|
|
To the O.P., I do not think that you can use CWinApp::m_lpCmdLine for that - I think it only contains true arguments, excluding the executable and its path.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
True. Sorry for the mis-post.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
|
|
|
|
|
Hi All,
Can anyone tell me how to add an icon to Windows Namespace? One way to do this is to add a key under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace, but for this one needs to have admin privileges on the system. Is there a different way by which a non admin user can do the same?
Thanks and Regards,
Anil
|
|
|
|
|
If there is no similar key under HKEY_CURRENT_USER there is no different way.
Don't try it, just do it!
|
|
|
|
|
|
Anil_vvs wrote: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace
but for accessing same key in user account you need ADMIN Priviledge there too.. have a try
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi All
I am using SHFormatDrive () to format any drive but the problem is that this function gives a windows dialog, I want to make this dialog silent so that if user press any button then irectly it format the drive.
Please guide me.
Thanks
|
|
|
|
|
|
Thats exactly what I thought.
BUT, there are some cases in which an automatted format might be desirable. If you inserted a floppy in an unknown format into my MIDI-Keyboard, it would automatically begin formatting it, if you had pressed the "Save Song X" button.
They would state that in the manual, but the first time it happened, it did cost me disk 22 of Monkey Island....
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
Sebastian Schneider wrote: but the first time it happened, it did cost me disk 22 of Monkey Island....
That's too bad...
|
|
|
|
|
toxcct wrote: virus like ?
So you start Teaching Virus Making here
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
oh no...
simply seeing that his software would behave like a virus...
this way, it was more an alarm signal for beeing careful for the ones who'd like to answer...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.24][3.0 soon...]
|
|
|
|
|
Have a look at the function FormatEx in fmifs.dll
I think there is (or at least, was) some article/sample at Systems Internals (http://www.sysinternals.com)
|
|
|
|
|
rajeevktripathi wrote: I want to make this dialog silent...
The format is controlled by the dialog interface. That is, the user must click the OK button to actually begin the format—the format cannot be started programmatically.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
|
|
|
|
|
Well, actually, it can. See my post. I have been using this func for ages in a program of mine. It even supports callbaks to a progress funtion (optional).
|
|
|
|
|
kakan wrote: Well, actually, it can.
SHFormatDrive() will always present a UI.
kakan wrote: See my post. I have been using this func for ages in a program of mine. It even supports callbaks to a progress funtion (optional).
The question, as well as my response, was regarding SHFormatDrive() , not FormatEx() .
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
|
|
|
|
|
Sorry, I misunderstood your post.
|
|
|
|
|
hi, im a mechanical engineering student and i've been given the task of calculating the second moment of area of three beams with different cross-sectional areas using the trapezium rule on c++ . i need the program to ask the user which cross-sectional area they want to calculate the SMOA for and use the corresponding data. the problem for me arises with the data for the heights and widths to be used as these are stored in txt files. the txt files contain a list of numbers: a single floating pt for the width, an integer, n, for the number of steps taken...which corresponds to the set of floating points which follow describing the height of the beam at these n points. i think i have to use an array to open and use the values, but one of the files has 20 values where the other two only have 10,(i.e.n=10 for two and n=20 for one) does anyone have any helpful hints for me? it would be very much appreciated!
thanks again
jo
-- modified at 11:14 Wednesday 22nd February, 2006
|
|
|
|
|
So your "width" text file has 20 values in it, and the "height" text file has 10 values in it. Is that correct? How about something like:
FILE *pFileHeight = fopen("height.txt", "r");
int nHeight[10],
x = 0;
while (! feof(pFileHeight))
{
fscanf("%d", &nHeight[x]);
x++;
}
fclose(pFileHeight);
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
|
|
|
|
|
|
You can use the macro
AfxGetMainWnd()
Have a nice code day
|
|
|
|
|
what are the lanuages that support dll?
JAYARAJ
|
|
|
|
|
Hi
Almost all languages in windows suport dll.
what do you do?
Agh
|
|
|
|