|
cool, thx!
~Nitron.
ññòòïðïðB A start
|
|
|
|
|
Nitron wrote: including CListCtrl
I know how you like CListCtrl
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
|
|
|
|
|
I have a windows program I'm developing in Visual C++ 6, and I need to be able to pass a command-line argument to the program. I'm familiar with doing this in console programs, and I've found instructions dealing with arguments in the main() or wmain() functions, but I've noticed that my program does not seem to have a main function. How is this possible? I thought all programs, visual or not, required a main function.
Kevin
|
|
|
|
|
ktaustin wrote: I'm familiar with doing this in console programs...
There is no difference between this and a GUI program. All command-line arguments follow the name of the program itself (e.g., myprogram.exe arg1 arg2 ...).
ktaustin wrote: I've noticed that my program does not seem to have a main function. How is this possible?
It's not. All programs have an "entry point" be it main() or WinMain() . The fact that you aren't seeing it does not mean it doesn't exist. Is this an MFC-based program?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Yes, this is an MFC-based program. I understand how to send arguments to the program, it's gaining access to the arguments within an MFC program that I don't understand. And by the way, you people are quick!
|
|
|
|
|
ktaustin wrote: Yes, this is an MFC-based program.
Then use CWinApp::m_lpCmdLine .
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
the main may be in a library you're linking to, as in the case with MFC.
Are you using MFC?
If so you can override InitInstance in your CWinApp derived class.
CWinApp::m_lpCmdLine has the command line
the WIN32 API GetCommandLine() will also give you the command line and you can use CommandLineToArgvW() to parse it into argv stile array of strings. However, if you call that, you will need to use GetCommandLineW()
Hope this helps
-- modified at 15:27 Tuesday 13th December, 2005
|
|
|
|
|
Thank you. I had difficulty reading m_lpCmdLine, but the GetCommandLine() function is working great. Thanks for the quick help.
Kevin
|
|
|
|
|
ktaustin wrote: I have a windows program I'm developing in Visual C++ 6,
Here is Wrapper class which deal with same :-
http://www.codeproject.com/cpp/cmdlineparser.asp[^]
"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
|
|
|
|
|
Hello,
I'm looking for an api that will give the the path to the registered .txt editor. I want my program to display a .txt file, but i don't want to make assumptions about what text editors may or may not be on the machine my code is running on.
I'm hoping i can pass ".txt" to a function, and get the default application associated with the ".txt" extension.
Thanks!
-Ian
|
|
|
|
|
ShellExecute or ShellExecuteEx will automagically map the extension to the proper registered program
|
|
|
|
|
Thank you very much for taking the time to help me solve my problem. I really appreciate it!
-Ian
|
|
|
|
|
What you want is either FindExecutable() or AssocQueryString() .
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Thank you very much for taking the time to help me solve my problem. FindExecutable looks like it will work for my purposes. Thanks much!
-Ian
|
|
|
|
|
Ian Bowler wrote: I'm hoping i can pass ".txt" to a function, and get the default application associated with the ".txt" extension.
In Continuation with Mr. Crow.. Here is Code demonstrating use of AssocQueryString :-
Using AssocQueryString to find Executable associated with the Ext.[^]
"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
|
|
|
|
|
Thank you very much for taking the time to help me solve my problem. I really appreciate it! I'll take a look at that example.
Thanks!
-Ian
|
|
|
|
|
I need some advice, as I am obviously missing something.
I am trying to add a desk band to my project, and all seems to be going well as far as the coding part is concerned. But how do you guys handle multiple builds and testing? You know the routine, you write some code, compile and build the dll, register it and try it out, unregister the dll, repeat. But I am having problems with the repeat part. The dll stays in use by windows, so it can not be deleted and rewritten when I do a rebuild. The only way I seem to be able to do this is by rebooting the computer.
Is there some trick that I can use to force windows to unload my dll?
I am using VC6 on W2K if that makes a difference.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
unregister the dll
start a command shell
taskkill /f /im "explorer.exe"
start explorer.exe
|
|
|
|
|
'taskkill' is not recognized...
But thanks anyway, I am able to kill explorer via task manager, and restart it via the command shell. All works great now
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
ah taskkill is a XP command.
|
|
|
|
|
Have u tried Process Explorer by SysInternals[^]. This will give u the exact module which is using your dll. Then you can kill that module using TaskManager.
|
|
|
|
|
Hello guys,
I have encountered next situation and it would be nice if someone could clarify this :
class Foo
{
public :
int number1;
}Object;
int main()
{
cout<<&Object<<endl;
cout<<&(Object.number1)<<endl;
}
Does this have any eplanation
Why is the address of a class object same as its member variables address;
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
|
|
|
|
|
|
Because number1 is the first member variable.
If you declare a second integer number2 below number1 in the class, its address will be 004575E4.
Best regards
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Giorgi Moniava wrote: Why is the address of a class object same as its member variables address
Why does that confuse you? Where else do you expect the members of a class to be stored?
This is correct behavior. It is simply telling you that the first member of Foo occupies the first memory location in Foo. If you add a member after the first and take it's address, then you will see it is N1 bytes after the first member's address, where N1 is the size of the first member.
|
|
|
|