|
kapardhi wrote: Can i get the name of this .exe programmatically.
within my application.
You can use __argv[0] .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
If yes:
Why?
If no:
1) Why?
2) How to do it
Thank you masters!
modified on Wednesday, April 1, 2009 7:48 AM
|
|
|
|
|
See here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Hi,
In my application I am using Active Sync to connect my PC to Mobile(Windows Mobile).I am using CeCreateProcess() function to invoke exe in mobile.I need to abort my application.
For that I have created one button on my dialog.I have added event handler to that.I have added
PostQuitMessage(0);
while running the application If I click on "Abort" button application is not closing at that point.After completion of present running task only application is closing. For example I am executing testcycle.In the middle I need to abort my application.Can anyone help me.
Rekha.
|
|
|
|
|
The clue is in the api command's name.
PostQuitMessage (0) .
It POSTs a WM_QUIT message to the message queue. This is a signal for your message loop to exit.
While you are still in a function, you're not handling messages... so you don't quit.
ie:
void CMyApp:OnSomeButton ()
{
PostQuitMessage (0);
Sleep (10000);
}
will take 10 seconds before it even could quit.
Not knowing what you're doing, that's as helpful as I can be at the moment.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
Hi,
In my Application I am connecting to Mobile and sending data to Mobile from my computer using socket.And I am receiving information from Mobile.
If I click on Abort button I need to stop Application.I am using MFC.
Can I use PostQuitMessage(0) for this?
|
|
|
|
|
hemlat wrote: Can I use PostQuitMessage(0) for this?
YES.
Now go and read my message again - it won't stop straight away. If you do many other things after the PostQuitMessage command, it will do them first.
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
exit [^] instead of PostQuitMessage ?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,
exit is not working.I am sending Data from my PC to Mobile.And I am receving data from my Mobile by using socket.I need to abort this operation.
|
|
|
|
|
it seems to dialog based application, why don't your try EndDialog() api!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
I need to close application immediately after clicking the abort button.
|
|
|
|
|
call EndDialog there only!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
i define my own reserved keyword like"_if,_while" and some operations
like "move","opendialogue" and some complex operations"<=","=="
and now i want to make a compiler to analyse "myself language"
how to make
thank you everybody
modified on Wednesday, April 1, 2009 6:15 AM
|
|
|
|
|
jeansea wrote: How I let compile know what i want to do
That's what source code is for...
Beyond that, I have no idea what you're asking.
Before writing code, you need to have a clear idea yourself what you want the computer to do for you. You need to be able to do the work yourself with pen and paper, then convert that to computer code.
Good luck,
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
sorry for my poor english
i know i write the code in a file IF.txt
now compiler to read the IF.txt
then to execute the code in IF.txt,i don't know now to execute the code
in IF.txt
holp you can realize what i say
|
|
|
|
|
jeansea wrote: sorry for my poor english
I don't mind - I was just having trouble working out how to help you.
Why are you writing code in a txt file? You are posting in a C/C++ forum, so what's wrong with writing C code?
If you are meaning some sort of script you can change anytime, then look at different technology, like (old timers shout "hey!") bat files, or the new windows scripting host scripts.
I haven't played with the new scripting very much though.
As CPallini said, maybe you should buy a book on C, and start reading. Hopefully it will make some sense - even if it only helps you ask more solid questions.
Good luck with your journey,
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
C++ is not a scripting language, so you can't compile things on the fly. You could however write your own 'scripting' language but if you need something a bit evolved, that would be a crazy solution. Why don't you instead integrate an existing scripting language into your application ? Take a look at LUA[^] for instance.
I guess that's what you are looking for but your question is not very clear. So if that's not waht you are looking for, rephrase your question so that it is a bit more understandable.
|
|
|
|
|
What are you trying to do?
Do you want to use your file as input for the C++ compiler?
If the answer is yes then you've to follow some rules, i.e. read a good C/C++ tutorial and try again.
Do you want instead to write your own compiler/ interpreter?
Then you should really read some good book about.
Do you want just to write a script?
Then have a look, for instance, at JScript or VBScrip t documentation.
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 write my own compiler/ interpreter
|
|
|
|
|
jeansea wrote: i want to write my own compiler/ interpreter
Compiler and interpreter belong to two different worlds. So, your first task would be to read up and understand how they both work and decide on choosing to create either a compiler or an interpreter.
Somehow I see this is an ambitious project for you, but goodluck nevertheless.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
thank you Reply my question
i want to make a compiler to analyse specify format(the format is i
define include the reserved keyword and other operations) files
but i don't have any ideas so write this for some help
|
|
|
|
|
I suppose you've to choose between them.
Would you start developing your first interpreter or your first compiler (Well, of course you can develp both, but you've to start with one of the two...)?
Roughly speaking developing a compiler is most difficult than an intepreter so you can start with the latter, if develpment difficulty is a factor.
Do you know that's Google matter [^]. There is also an article series, here at CP [^].
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]
|
|
|
|
|
Are you sure this is really what you want to do ? As the other pointed out, that's a difficult task. You need to ask yourself two questions:
1) Do you really need to be able to execute code from a text file at runtime ? Can't you 'simplify' your task into something like a condition and an action (that's more or less your example) ? If you design it cleverly, it could simplify a lot your code.
2) If that's not possible, are you sure you want to write your own interpreted ? Can't you use an existing scripting language instead of rewriting it yourself. If they exist, this is for a specific reason. If you already looked at this and found it too difficult, well think again because doing it yourself is gonna be way more complicated than that...
|
|
|
|
|
i accept your advice and then how could i do.could you give me more details
thank you very much
|
|
|
|
|
jeansea wrote: could you give me more details
That will be very difficult, since you didn't provide a lot of details on what you want to achieve...
|
|
|
|