|
|
|
The official MFC way is to:
- derive a class from CCommandLineInfo and overide CCommandLineInfo::ParseParam
- call CWinApp::ParseCommandLine in your overide of CWinApp::InitInstance using an instance of your class derived from CCommandLineInfo.
When a new instance of your application starts CWinApp::ParseCommandLine slices the command line into tokens and chucks each on in turn into "YourDerivedClass"::ParseParam. ParseParam can do whatever it likes with the tokens it gets - raise or lower flags, set global state, you name it.
If you want a simple class to explore these concepts try this for size:
class simple_command_line_parser : public CCommandLineInfo
{
public:
void ParseParam( const wchar_t* parameter, BOOL, BOOL )
{
::AfxMessageBox( parameter );
}
};
All it does is display the parameters it recieves in a message box. You'd use it by adding the following two line to your App's InitInstance:
simple_command_line_parser sclp;
ParseCommandLine( sclp );
Anyway, hope that helps!
Ash
|
|
|
|
|
this makes absolutley no sense as to why this is happening...
Here is the scenerio:
I have an INI file that gets uploaded into some product durring the test.
I have to modify the INI file before upload, so I do so using WritePrivateProfileString(x,x,x,x). Return value is good, no errors.
Read the settings I just changed in the INI file via the GetPrivateProfileString(x,x,x,x), values returned match what I changed them to,
ok, stop there.. (via breakpoint or messagebox)
Now, go into windows explorer and open the INI file and none of the data in the INI file has changed per the write command.
Now, exit the program, or stop it if in the enviornment. Now go and read the INI data from the INI file in windows explorer.. The data is now changed.
Or you can simplely write some data to a bogus file and it will force the INI file to get updated...
OK, now the reason this is such a problem is that after I modify the INI file I have to start the upload process, but I can't because the upload procss graps the file from windows, except the file hasn't been updated yet to the values I wrote using the writeprivateprofilestring command.
This makes no sense to me. Why is windows waiting to update the actual file? Is the a command I need to send to force windows to release the cach so that the file gets updated?
Hopefully someone can explaing what is going on here... Any information will help.. I hope I am so confused by this....
|
|
|
|
|
See the description here[^], particularly the paragraph that states:
The system keeps a cached version of the most recent registry file mapping to improve performance. If all parameters are NULL, the function flushes the cache. While the system is editing the cached version of the file, processes that edit the file itself will use the original file until the cache has been cleared.
It's time for a new signature.
|
|
|
|
|
Sounds like a caching issue. Would it help to call RegCloseKey() when done writing?
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Dear friends,
how to create blank wmv file in visual c++ witout using any tools..
I tried different way, didn't get any result. so if anyone know about this
give some ideas of creation of blank wmv file
i am looking forward..
regards
Mohanchandra
|
|
|
|
|
hiii......i m a btech final year student & trying to do the netdefender firewall.there is occur problem during loading the system driver "DrvFltIp".can anybody tell me about this driver wroking & how it call the startService()method...
|
|
|
|
|
Hi,
How could I Send UTF-8 URL By following code in szTranReq:
CHttpFile* pHttpFile = pInetHttpConnection->OpenRequest(
CHttpConnection::HTTP_VERB_GET, szTranReq,
NULL, 1, NULL, L"1.1", INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_DONT_CACHE | INTERNET_FLAG_RELOAD);
|
|
|
|
|
m_code wrote: ... NULL, 1, NULL, L"1.1", INTERNET_FLAG_EXISTING_CONNECT ...
The L prefix generates a Unicode (UTF-16) string.
It's time for a new signature.
|
|
|
|
|
Of course, I mean how the content of szTranReq Object could be transmitted to the server as UTF-8, because When It is CStringW and contain non-ASCII characters the server do not recognize them.
|
|
|
|
|
You are free to send ASCII characters via this call. However you need to ensure that the characters sent are in a format that is accepted and understood by the server.
It's time for a new signature.
|
|
|
|
|
I know that the server recognize UTF-8 for content of http-Get Object, But I don't know how to send my Unicode Object, containing Russian words to sever because when I send them normally the sever misunderstand them with "???"
|
|
|
|
|
The problem is not in the transmission of data, but rather getting the client and server to speak the same 'language'. If the server does not accept Russian characters then there is nothing the client can do to change that. You need to work with the server support people to find out what format your data needs to be in to be accepted by the server. If it will accept UTF-8 then you need to convert your Unicode characters to multi-byte UTF-8 before sending.
It's time for a new signature.
|
|
|
|
|
Hi,
I have a JPEG file I would like to use as a cursor
is there any way or product I can use to accomplish this ???
thankx
|
|
|
|
|
icoFx[^] probably has what you need.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
Seems like this producut just for creating ICONS
|
|
|
|
|
Sorry about that, i keep "mixing up" ICO and CUR...must be bad genes
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
I do the same u right ....
My boss screams at me all the time personally I think (at least on my part its lack of conecntration yeah genes ADHD )
|
|
|
|
|
Yeah, i had my share of screaming boss too sadly...was no fun...my condolences...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
It not free but .... I re-saved my file as jpg opened it under awicons saved it as .cur ......
|
|
|
|
|
Yes, It's me again
Okay, trying to store 5 cards into a two dimensional array.
Got handBoard[13][4] initialized to all 0's
hand[0] through hand[4] each are holding a random number between 0 and 51.
When I try to populate the two-dimensional array to show the five cards, I get random sections of the array sprouting 1's I didn't specify. Here is the section of the code that should be populating my array.
<code>
for (count = 0; count < 5; count++)
{
if (hand[count] < 13)
handColumn[count] = 0;
else if (( hand[count] > 13) && (hand[count] < 26))
handColumn[count] = 1;
else if ((hand[count] > 26) && (hand[count] < 39))
handColumn[count] = 2;
else if (39 < hand[count])
handColumn[count] = 3;
}
// setting which column the hand goes into
for (count = 0; count < 5; count++)
{
if ((hand[count] == 0) || (hand[count] == 13) || (hand[count] == 26) || (hand[count] == 39))
handRow[count] = 0;
else if ((hand[count] == 1) || (hand[count] == 14) || (hand[count] == 27) || (hand[count] == 40))
handRow[count] = 1;
else if ((hand[count] == 2) || (hand[count] == 15) || (hand[count] == 28) || (hand[count] == 41))
handRow[count] = 2;
else if ((hand[count] == 3) || (hand[count] == 16) || (hand[count] == 29) || (hand[count] == 42))
handRow[count] = 3;
else if ((hand[count] == 4) || (hand[count] == 17) || (hand[count] == 30) || (hand[count] == 43))
handRow[count] = 4;
else if ((hand[count] == 5) || (hand[count] == 18) || (hand[count] == 31) || (hand[count] == 44))
handRow[count] = 5;
else if ((hand[count] == 6) || (hand[count] == 19) || (hand[count] == 32) || (hand[count] == 45))
handRow[count] = 6;
else if ((hand[count] == 7) || (hand[count] == 20) || (hand[count] == 33) || (hand[count] == 46))
handRow[count] = 7;
else if ((hand[count] == 8) || (hand[count] == 21) || (hand[count] == 34) || (hand[count] == 47))
handRow[count] = 8;
else if ((hand[count] == 9) || (hand[count] == 22) || (hand[count] == 35) || (hand[count] == 48))
handRow[count] = 9;
else if ((hand[count] == 10) || (hand[count] == 23) || (hand[count] == 36) || (hand[count] == 49))
handRow[count] = 10;
else if ((hand[count] == 11) || (hand[count] == 24) || (hand[count] == 37) || (hand[count] == 50))
handRow[count] = 11;
else if ((hand[count] == 12) || (hand[count] == 25) || (hand[count] == 38) || (hand[count] == 51))
handRow[count] = 12;
}
// setting which column the hand goes into
for(count = 0; count < 5; count++)
handBoard[handColumn[count]][handRow[count]] = 1;
for(count = 0; count < 13; count++)
cout << handBoard[0][count] << ' ';
cout << endl;
for(count = 0; count < 13; count++)
cout << handBoard[1][count] << ' ';
cout << endl;
for(count = 0; count < 13; count++)
cout << handBoard[2][count] << ' ';
cout << endl;
for(count = 0; count < 13; count++)
cout << handBoard[3][count] << ' ';
cout << endl;
// printing out the array to see if it populates correctly.
</code>
This has been the biggest headache ever. Please, any help?
-- Modified Sunday, May 16, 2010 12:27 PM
|
|
|
|
|
Hi,
1.
you have an error in else if (( hand[count] > 13) && (hand[count] < 26))
what with the values 13, 26, 39 themselves?
2.
you could do the same with less code (and less bugs) by using division and modulo operators.
for positive integers, division yields the integer quotient, and modulo (aka remainder) yields the modulus (or remainder after division).
Example: instead of
if (hand[count] < 13)
handColumn[count] = 0;
else if (( hand[count] > 13) && (hand[count] < 26))
handColumn[count] = 1;
else if ((hand[count] > 26) && (hand[count] < 39))
handColumn[count] = 2;
else if (39 < hand[count])
handColumn[count] = 3;
do
handColumn[count] = hand[count]/13;
that is one line replacing 8, and eliminating the bugs.
And instead of
if ((hand[count] == 0) || (hand[count] == 13) || (hand[count] == 26) || (hand[count] == 39))
handRow[count] = 0;
else if ((hand[count] == 1) || (hand[count] == 14) || (hand[count] == 27) || (hand[count] == 40))
handRow[count] = 1;
...
else if ((hand[count] == 12) || (hand[count] == 25) || (hand[count] == 38) || (hand[count] == 51))
handRow[count] = 12;
do
handRow[count] = hand[count]%13;
now replacing 26 lines.
3.
In general, any time you have a lot of lines that are almost identical, there probably is a smarter way to achieve the same with less code; sometimes it takes an operator, sometimes a loop. However, before committing to similar lines of code, rethink the matter.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
1.
you have an error in else if (( hand[count] > 13) && (hand[count] < 26)) what with the values 13, 26, 39 themselves?
The values of 13, 26, and 39 (and 0 (not shown)) are the values identifying the Ace card in an array of cards from 0 - 51. Ahh! I see the error. It should be (( hand[count] > 12) && (hand[count] < 26)) correct?
2.
handColumn[count] = hand[count]/13;
I'm not understanding how this works, apparently. If count is 3, then handColumn[3] = hand[3]/13;. What if hand[3] was 15? Then 15/13 would be 1..... wait! Thats it! 15/13 would be 1.18 or something, but with an int callout, would only display as 1, which would put it in the second column being as it is the second set of cards! Wow... I'm glad I picked up on that. That makes a whole lot of sense. Thanks again!
3.
handRow[count] = hand[count]%13;
Now let's see if I can understand this. Once again, hand[count] is 15. So, 13/15 is 1 with a remainder of 2, so it would put 15 in the 2 row. 15 in a 0-51 deck is card number 3, which would go into the 3rd row which is 2. Okay, I can see how that works now! Thanks a third time!
Now I need to figure out how to use all of this to determine if the set of five cards meets any win conditions for poker....
Thanks a bunch for all the help!
|
|
|
|
|
You're welcome.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|