I have an W32 application that runs through Winmain. How do I pass command line arguments straight into the program? I can do it with int main(int arg...) but Winmain won't. Do I need a constructor?
- Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
- Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
C++ Winmain commandline arguments?
Collapse
X
-
reynolds
reynolds- Thanks (Given):
- 0
- Thanks (Received):
- 0
- Likes (Given):
- 0
- Likes (Received):
- 0
-
SupremeSpod
SupremeSpod- Thanks (Given):
- 0
- Thanks (Received):
- 0
- Likes (Given):
- 0
- Likes (Received):
- 0
What a TWAT!
Have you never written a windows C++ program before?
You've done nothing but post for help, I hope you're not getting paid for this tulipe!
Try MSDN! -
reynolds
reynolds- Thanks (Given):
- 0
- Thanks (Received):
- 0
- Likes (Given):
- 0
- Likes (Received):
- 0
@#%$ you
sorry i ain't got my head up bill gate's up arse you knob.
and your answer is...? its alright slagging off when you haven't got the answer.
SS, you post something on here about Java and rip the pi.ss likewise.Comment
-
DimPrawn
DimPrawn- Thanks (Given):
- 0
- Thanks (Received):
- 0
- Likes (Given):
- 0
- Likes (Received):
- 0
Reynolds,
Writing C++ Windows apps is back in the dark ages.
Get yourself into C# and .Net and knock up these things in minutes, not weeks/months.
Join the 21st century mate.
Or alternatively outsource the whole dev to India for a fiver.Comment
-
reynolds
reynolds- Thanks (Given):
- 0
- Thanks (Received):
- 0
- Likes (Given):
- 0
- Likes (Received):
- 0
re
dimprawn as i said
"you post something on here about Java and <i'll> rip the pi.ss likewise. "
i am an expert in Java - which is up to date and better than C#. i want to learn more C++ because of hacking reasons - modern languages are too safe.Comment
-
reynolds
reynolds- Thanks (Given):
- 0
- Thanks (Received):
- 0
- Likes (Given):
- 0
- Likes (Received):
- 0
re
and another thing supremespud, i'm posting on here so search engines will parse it and it will help others learn (ala experts-exchange.com). again ss, thanks for your very helpful answer.Comment
-
reynolds
reynolds- Thanks (Given):
- 0
- Thanks (Received):
- 0
- Likes (Given):
- 0
- Likes (Received):
- 0
command line args answer..
in the main method:
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow )
LPSTR lpCmdLine represents the whole command line argument in bytes.Comment
-
SupremeSpod
SupremeSpod- Thanks (Given):
- 0
- Thanks (Received):
- 0
- Likes (Given):
- 0
- Likes (Received):
- 0
And another way is...
now kiss my arse you prick!// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
cerr << _T("Fatal Error: MFC initialization failed"
<< endl;
nRetCode = 1;
}
else
{
// your code here
}
As for ripping into me re: Java I wouldn't touch that tulipe with a bargepole!
Spod - In "Learn a real language" mode!Comment
-
reynolds
reynolds- Thanks (Given):
- 0
- Thanks (Received):
- 0
- Likes (Given):
- 0
- Likes (Received):
- 0
Rubbish
Thats wrong Spod.
The constructor :
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
provides the answer - "lpCmdLine" is the variable.
you are the arse. now get back to your drag and drop software my friend.Comment
-
SupremeSpod
SupremeSpod- Thanks (Given):
- 0
- Thanks (Received):
- 0
- Likes (Given):
- 0
- Likes (Received):
- 0
- Home
- News & Features
- First Timers
- IR35 / S660 / BN66
- Employee Benefit Trusts
- Agency Workers Regulations
- MSC Legislation
- Limited Companies
- Dividends
- Umbrella Company
- VAT / Flat Rate VAT
- Job News & Guides
- Money News & Guides
- Guide to Contracts
- Successful Contracting
- Contracting Overseas
- Contractor Calculators
- MVL
- Contractor Expenses
Advertisers
Contractor Services
CUK News
- Umbrella company winding-up petitions in 2026: the practical guide for contractors Yesterday 05:29
- Payments on Account deadline: what contractors must do before July 31st — maybe for the final few times Jul 28 08:01
- Andy Burnham's first 100 days: five things contractors need from the new PM Jul 27 00:53
- Starmer vs Burnham on housing: What their rival plans mean for your contractor mortgage Jul 22 00:59
- Burnham's housing vision vs. Starmer's home-buying reforms: what it means for your contractor mortgage Jul 22 00:59
- In Khalil v Innovate Transport, a limited company contractor wasn’t a worker and was on £2.30 — not £230 Jul 21 07:58
- Andy Burnham is PM: 5 new IT policies set to shape UK tech and its contractors Jul 20 06:29
- Taxed on money I haven't earned yet? Bold move, HMRC Jul 17 08:36
- The Fair Work Agency has got zero hours in its sights. Do you? Jul 16 08:44
- Cookie Policy Jul 15 11:50

Comment