|
Oh duh, I didn't even notice the lpCmdLine there in the WinMain. Thanks, I'm all set!
KR
|
|
|
|
|
KellyR wrote: I'm not using MFC in this program, so how do I process that argument?
Well, what are you using then?
You say that using "Windows GUI", but what do you mean by that?
If you're using another framework then the documentation for that framework must have some information about how to get hold of the program arguments. So if you're using any kind of framework you're basically the best suited for answering your question.
If you've implemented the main function you can get the program arguments as desccribed here[^].
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"No one remembers a coward!" - Jan Elfström 1998 "...but everyone remembers an idiot!" - my lawyer 2005 when heard of Jan's saying above
|
|
|
|
|
Roger Stoltz wrote: If you're using another framework
In fact you don't need a framework to build up a Windows GUI application.
(for instance using Visual Studio 6, you can choose Win32 application to start a full featured GUI application without using MFC, it's the hard way, but it's there...).
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.
|
|
|
|
|
CPallini wrote: In fact you don't need a framework to build up a Windows GUI application.
Of course you don't.
You can always start with WinMain .
I even provided information about how to do it the old way if he was creating a console application: the link.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"No one remembers a coward!" - Jan Elfström 1998 "...but everyone remembers an idiot!" - my lawyer 2005 when heard of Jan's saying above
|
|
|
|
|
Roger Stoltz wrote: I even provided information about how to do it the old way if he was creating a console application: the link.
He actually needed info about WinMain , not main .
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.
|
|
|
|
|
CPallini wrote: He actually needed info about WinMain, not main.
That was your guess, which turned out to be right.
But nothing in the first post made that clear.
If you take a look at David's reply below he's given an answer to exactly what the OP asked for, since he wanted to know "what happens to the file data".
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"No one remembers a coward!" - Jan Elfström 1998 "...but everyone remembers an idiot!" - my lawyer 2005 when heard of Jan's saying above
|
|
|
|
|
Actually it wasn't a guess (was exaustive of my knowledge):
first I suggested (like you, I think) MFC m_lpCmdLine , then argv[1] of console apps and lpCmdLine of WinMain .
Roger Stoltz wrote: If you take a look at David's reply below he's given an answer to exactly what the OP asked for, since he wanted to know "what happens to the file data".
I agree. But some times these MVPs seem to be a bit rude with newbies like me!!!;)
-- modified at 14:09 Wednesday 10th January, 2007
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.
|
|
|
|
|
Part of effectively answering a question lies within determining what information the questioner is truly looking for. This is why I included an explanation in my original post about what I needed the file data for (just in case my question, 'what happens to the file data' was not actually what I needed to know). As we all know, sometimes the questions people ask on this site are unclear, or directed towards the wrong problem.
I do strive to make my questions as clear and understandable as possible, as well as post effective and comprehensive answers to questions that I can help with.
Thanks to all of you for doing your best to effectively answer my question. My program now does what I need it to do.
KR
|
|
|
|
|
KellyR wrote: My program now does what I need it to do.
Nice to hear (read?).
KellyR wrote: Part of effectively answering a question lies within determining what information the questioner is truly looking for
This is absolutely true.
However, sometimes the poster is unaware of a better solution for a problem that he or she is trying to solve, or the poster has misunderstood something at a conceptual level. This is often hard to get at and that's why I sometimes get a little provocative trying to make people think and maybe rephrase their questions.
I know it can be a thin line before I offend people, but my intentions are to help to the best of my knowledge and I think that goes for anyone who contributes to this community. If that's worth something, is for the person with the question to decide.
It's even harder when we have cultural differences, different experiences and many of us don't have english as our native language. Often we have to guess and sometimes we are wrong. Thus I think it's better to answer in way that one can understand that there are many different ways to solve a problem and to which is best might require more information.
Hmm, close to Lounge material... Sorry...
--
Roger
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"No one remembers a coward!" - Jan Elfström 1998 "...but everyone remembers an idiot!" - my lawyer 2005 when heard of Jan's saying above
|
|
|
|
|
KellyR wrote: Thanks to all of you for doing your best to effectively answer my question. My program now does what I need it to do.
You're welcome!
KellyR wrote: Part of effectively answering a question lies within determining what information the questioner is truly looking for. This is why I included an explanation in my original post about what I needed the file data for (just in case my question, 'what happens to the file data' was not actually what I needed to know). As we all know, sometimes the questions people ask on this site are unclear, or directed towards the wrong problem.
I do strive to make my questions as clear and understandable as possible, as well as post effective and comprehensive answers to questions that I can help with.
Don't worry about!!!!
Sometimes we like to have small debates............
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.
|
|
|
|
|
If you do not have access to the argument count or to the arguments themselves, you can make a call to ::GetCommandLine() to get a TCHAR -style string containing all of the arguments.
If you need access to the arguments using a C-style array of string pointers, you can use the CommandLineToArgvW(...) function to do that (note that you will have to do any necessary conversion to/from Unicode yourself).
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> 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! See DeleteFXPFiles
|
|
|
|
|
Thank you for the useful information. In this case I have the argument in WinMain but this is good to know in case I'm using something else.
KR
|
|
|
|
|
KellyR wrote: When I double-click on the file, and it opens up my program, what happens to the file data?
Nothing, by default. The shell simply lets your program know the name of the file you requested to open. It's up to your program to actually do something with it.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Is it possible with a class derived from CDialog? Can I do some SetMinimiseButtonPos() or SetCloseButtonPos() tricks somehow?
And another question about titlebar, is it possible to center titlebar's text?
Thanks in advance;)
|
|
|
|
|
PatrykDabrowski wrote: Is it possible with a class derived from CDialog? Can I do some SetMinimiseButtonPos() or SetCloseButtonPos() tricks somehow?
And another question about titlebar, is it possible to center titlebar's text?
You will have to draw the whole title bar yourself, hide all the buttons and provide all default functionality yourself, See this article[^]
mostly applications just hide the title bar and paint a new title bar on the window area itself.
If you think you can than you can, if you think you can't you are right.
|
|
|
|
|
What is the simplest way for doing this? All i want is to get rid off that annoying confirmation dialog stating "Unidentified Publisher" and asking to confirm launching, because on any other grounds, my app is fully compitable with Vista.
I tried to embed the following manifest, i.e. added the trustInfo part, but it doesn't seem to have changed anything, need some code signing crap...sorry.
Anyone? Please!!!!
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly
xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
<assemblyIdentity
processorArchitecture="x86"
version="5.1.0.0"
type="win32"
name="ACTWin.exe"/>
<description>ACTWin</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="highestAvailable" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
publicKeyToken="6595b64144ccf1df"
language="*"
processorArchitecture="x86"/>
</dependentAssembly>
</dependency>
</assembly>
|
|
|
|
|
Signing has nothing to do with the manifest. You need to buy a code signing certificate, and use that to sign the EXE.
Also, unless your program does administrative tasks, you should use level='asInvoker'
|
|
|
|
|
Hello,
how to use this to save new files with warning message if a file with the same name exist?
In my case i overide the existing file without any warning!!!
thanks
break;
|
|
|
|
|
You need to use OFN_OVERWRITEPROMPT flag in OPENFILENAME struct.
|
|
|
|
|
Hello Prasad,
thanks wery much, that is
regards
break;
|
|
|
|
|
Hi All
I am converting my non-unicode project to unicode , in this case when i compiling my code i get errors where char data type is used, so does it means that i can not use char data type in unicode? Is it necessary to convert all char. variables to wchar_t or TCHAR variables.
Thank you
Atul Mahajan
Atool
|
|
|
|
|
M. Atul wrote: can we use char datatype in unicode
Yes, it depends on what you plan to do with a char in a UNICODE build, every(almost all) WIN32 api function has two variants A and W (e.g. SetWindowTextA and SetWindowTextW ) xxxW version is called if unicode is defined other wise xxxA if you pass char to xxxW then it will not compile, keeping that in mind if you want to store an 8 bit value and check its individual bits there is nothing stopping you from doing that in a UNICODE build IMHO.
If you think you can than you can, if you think you can't you are right.
|
|
|
|
|
M. Atul wrote: ...i get errors where char data type is used...
You'll need to use wchar_t or TCHAR instead.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
This is a problem which i have been facing for a long time.
Now i found a new thing in it (a step ahead) that i am getting an error below....
BOOL CWnd::DestroyWindow()
{
if (m_hWnd == NULL)
return FALSE;
CHandleMap* pMap = afxMapHWND();
ASSERT(pMap != NULL);
CWnd* pWnd = (CWnd*)pMap->LookupPermanent(m_hWnd);
#ifdef _DEBUG
HWND hWndOrig = m_hWnd;
#endif
#ifdef _AFX_NO_OCC_SUPPORT
BOOL bResult = ::DestroyWindow(m_hWnd);
#else //_AFX_NO_OCC_SUPPORT
BOOL bResult;
if (m_pCtrlSite == NULL)
bResult = ::DestroyWindow(m_hWnd);
else
bResult = m_pCtrlSite->DestroyControl();
#endif //_AFX_NO_OCC_SUPPORT
if (pWnd != NULL)
{
#ifdef _DEBUG
ASSERT(pMap->LookupPermanent(hWndOrig) == NULL);
#endif
}
else
{
#ifdef _DEBUG
ASSERT(m_hWnd == hWndOrig);
#endif
Detach();
}
return bResult;
}
What does it mean and What i have to do?
KIRAN PINJARLA
|
|
|
|
|
Here i found a similar question in codeguru forum [^]. But did not understand the answer given by Jonny Poet.
He said
open the 'Calling list Viewer' ( I dont know the english exact word),
where you can see all the calls which have been done to get to this point.
In that list you look backword this list to find the next point where there is
a name of a function of your program This was then obviously the point
where from it comes.Before that you set your breakpoint.And then you will se why
this happens.
what does he mean by the 'Calling list Viewer' and where can i get that?
-- modified at 6:09 Wednesday 10th January, 2007
KIRAN PINJARLA
|
|
|
|