|
Hi
try this (short form):
<br />
DWORD Size, Tmp;<br />
if (Size = GetFileVersionInfoSize(PathName, &Tmp))<br />
{<br />
char *Info = new char[Size];<br />
if (GetFileVersionInfo(PathName, 0, Size, Info))<br />
{<br />
void *lpBuffer;<br />
UINT dwBytes;<br />
<br />
if (VerQueryValue(Info, TEXT("\\"), &lpBuffer, &dwBytes))<br />
{<br />
VS_FIXEDFILEINFO *lpvsFixedFileInfo = (VS_FIXEDFILEINFO *)lpBuffer; <br />
...<br />
}<br />
}<br />
delete[] Info;<br />
}<br />
HTH
Regards,
Frank
|
|
|
|
|
Just study vc++,ask a very simple question,how to call system command in vc++? thanks in advance!
|
|
|
|
|
system("");
usually works. ie, to do a dir, put in
system("dir");
*.*
cin >> knowledge;
|
|
|
|
|
This is probably a very basic question, so bear with me
I'm writing a console program and need to use asynchronous sockets. I wish to use WSAAsynchSelect(). The second parameter is a HWND to the window you want to handle the messages. The third parameter is the message you want handled. The events are specified in the fourth parameter. What I thought I could do was use a message loop, like
while( bRet = GetMessage( &msg, NULL, 0, 0 ) != 0 )
{
if( bRet == -1 )
{
// handle
}
TranslateMessage( &msg );
DispatchMessage( &msg );
}
and have the WinProc handle the message specified in WSAAsynchSelect().
The problem I'm having is that I get an "Invalid Argument" error (runtime) when WSAAsynchSelect() is called and I think it's because I'm sending a NULL instead of a valid HWND.
My question is, does anyone know have advice how to use WSAAsynchSelect() in a console application?
Thanks!
mweiss
|
|
|
|
|
I guess you need to create some window to receive the messages - even in console app you can create windows - best choice will be some invisible - message only window (parent is HWND_MESSAGE ). Then you'll have all - valid HWND , valid MsgProc for that window etc.
Hope this helps
|
|
|
|
|
Thanks for the reply.
I found a way to do it without using the windows. I use WSAEventSelect(), WSAWaitForMultipleEvents() and WSAEnumNetworkEvents(). I set up the events in the main thread and in a worker thread wait for events to occur, check which event it was and handle it. I haven't tested it yet, tho.
Thanks.
melinda
|
|
|
|
|
Yes, that's the better method, but you stated that you wish to use the before method, and I prefer to respect ppl. wishes
Anyway, this is much better what you do now, the messaging part (window) is useful only when you have to handle the winsock 1.
Only disadvantage is that you have two threads - mean the whole design is more complicated due to resource locking etc. I usualy trying to design it that it uses only one thread for all that tasks. But it really depends on the application, so there cannot be a general advice except that I said.
wish you good luck!
|
|
|
|
|
I need help with a few more programs please help me.
Thank you Neville Franks and DougwW48 for help earlier, I appreciate it. Please help me one more time.
I tried these and they start like this one:
#include "conio.h"
#include "stdio.h"
void main ()
{
getch();
}
The questions are:
compile a program that will ask the user for an amount in cents ($1.23 = 123 cents). It should then display the number of quarters, dimes, nickels, and pennies equal to the amount.
compile a program that will ask the user for their age. If the age entered is greater than or equal to 18, the program should display that the user is old enough to vote. Otherwise, the program should tell how many years until the user can vote.
compile a program that will ask the user for two floating point numbers. The second number asked for should be the percentage the user wants to find of the first number. It should then display the result of finding the percentage in this format:
Example:
Enter a number: 25
What percent of 25 would you like to find? 3
3% of 25 is 0.75
Thanks a lot for the help.
I get so close on these but can't seem to get them working, i always get 1 or 2 errors. Thanks
|
|
|
|
|
i think you should post you program...what you have done till now... and ask ppl to rectify your errors rather than asking the questions and make ppl do your homework for you...
it will do you good..
With Regards
Joseph R. Thomas
Have a Super Blessed Day!
-------------------------
For God has not given us a spirit of fear, but of power and of love and of a sound mind.
2 Timothy 1:7
|
|
|
|
|
so close to what?
finishing your homework??
With Regards
Joseph R. Thomas
Have a Super Blessed Day!
-------------------------
For God has not given us a spirit of fear, but of power and of love and of a sound mind.
2 Timothy 1:7
|
|
|
|
|
looking at your question..it seems that these are the first or secong questions of the C++ language learning that you might be doin...if you ask others to do it for you...you wont be able to learn the language at all...
so i suggest u take up a book and start some serious learning...
With Regards
Joseph R. Thomas
Have a Super Blessed Day!
-------------------------
For God has not given us a spirit of fear, but of power and of love and of a sound mind.
2 Timothy 1:7
|
|
|
|
|
Colin;
I agree with the other guys that you really need to learn this stuff on your own if you ever hope to understand it! And don't freak out about projects, it'll only make them seem more difficult. I'll help you out on the money question this time. From the code that Neville and myself have sent you so far, you should be able just to change a few lines and complete your other questions.
colin21 wrote:
compile a program that will ask the user for an amount in cents ($1.23 = 123 cents). It should then display the number of quarters, dimes, nickels, and pennies equal to the amount.
#include <iostream>
using namespace std;
int main()
{
int Total, Quarters, Dimes, Nickels, Pennies;
cout << "Enter the total amount of cents: ";
cin >> Total;
Pennies = Total;
Quarters = Pennies / 25;
Pennies = Pennies % 25;
Dimes = Pennies / 10;
Pennies = Pennies % 10;
Nickels = Pennies / 5;
Pennies = Pennies % 5;
cout << "$" << Total/100 << "." << Total%100 << " is equal to:\n";
cout << Quarters << " quarters\n";
cout << Dimes << " dimes\n";
cout << Nickels << " nickels\n";
cout << Pennies << " pennies\n";
return 1;
}
If you have questions on your other two projects, it would probably be a good idea to post your code so people can help you fix what you have wrong instead of guessing and giving you the answers. I hope I got an A!
Douglas A. Wright
dawrigh3@kent.edu
|
|
|
|
|
the code(s) that you gave me don't work at all. mine use printf and scanf and they use parentheses not << >>. thanks for helping though, i am seeming to get it better now. i will take your advice and post what i have so far and then ask. maybe you can help me better then.
[Colin]
|
|
|
|
|
Sorry about the cin and cout statements, I assumed you were taking c++ and not c. It shouldn't be hard to change them into scanf and printf statements. Good luck!
Douglas A. Wright
dawrigh3@kent.edu
|
|
|
|
|
I use icons from system dlls in my app
TreeView draws thick black edge instead of
transparent shadow. What is the best way to solve this problem?
Thanks in advance.
|
|
|
|
|
Hi,
Don't ask me why, but I wanna create a button the hard way. I don't want to use the CButton class.
So basically I want to call the CreateWindow function with a class I registered my self. I already discovered I can use the predefined control-class WC_BUTTON with the following call to get a button on my window:
CreateWindow(WC_BUTTON,"caption",<styles>,0,0,200,200,hWnd,NULL,hInstance,NULL);
only problem is, I can't link an eventhandler to the button, right? Or maybe I just don't know how..
Anyways, the other way I thought of was registering my own class (using RegisterClass and the WNDCLASS struct) and specifying my own WndProc to handle events. But how do I configure the class as a button, in other words how do I make it look like a button, which is pushable? Or will it actually be that hard that I need to define my own graphics, on MBUTTONDOWN the sunken box is painted, etc.
I'm just interested in the way this stuff works... if somebody knows something, please let me know too
Many thanks in advance,
DanglingDude.
|
|
|
|
|
If i right understand your question
it can be done creating button using
CreateWindow(WC_BUTTON ...) and then setting its WndProc
to your own defined using
<br />
LONG DefWndProc=SetWindowLong(hWndButton,GWL_WNDPROC,lpfnYourOwnWndProc);<br />
you should also call default button process using pointer returned by SetWindowLong() at return of your own WndProc.
|
|
|
|
|
Aaaah, this is exactly what I needed.
Thanks alot!
|
|
|
|
|
An alternative to providing a new wndproc for the button, the button control sends a BN_CLICKED message through a WM_COMMAND to the parent window when the button is click. You'll be able to listen out for that. I find that easier (depending on the circumstances) than providing a new wndproc for the button.
Phil
|
|
|
|
|
Hi
I just upgraded from Visual C++ 6 to .NET, and I can't find an option to set the paths for includes and libs, where is it gone? I need to include the boost regex directory into my project.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
It's hidden a little bit.
Go to the Tools/Options.
Here in a tree on the left go to Projects and you'll see VC++ Directories.
You're in then!
hope this helps
|
|
|
|
|
Ah, this was really a tricky one.
Thanks a lot!
modified 12-Sep-18 21:01pm.
|
|
|
|
|
hello iv been trying all day to register the login details for my irc client that i coded with winsock in vc++,here's the code im executing it all compiles nicley but it just wont register with irc, please help
CString m_User;
CString m_Nick;
CString m_Channel;
CString m_Pass;
m_Pass = " secretpass ";
m_Nick = " chris";
m_User = " chris na www.baka-baka.com:chris shread";
m_Channel = " projectx ";
CString PassCommand = "PASS" + m_Pass + "\r\n";
CString NickCommand = "NICK" + m_Nick + "\r\n";
CString UserCommand = "USER" + m_User + "\r\n";
CString JoinCommand = "JOIN" + m_Channel + "\r\n";
send(Socket,PassCommand,strlen(PassCommand),0);
send(Socket,NickCommand,strlen(NickCommand),0);
send(Socket,UserCommand,strlen(UserCommand),0);
send(Socket,JoinCommand,strlen(JoinCommand),0);
it replys saying i have to register b4 i can join??
well iv tried registering as u can c but no joy
thank you all!
|
|
|
|
|
Could someone tell me how to do a memory dump in XP. Tried the old DOS method, but it's not supported.
Thanks, Paul
|
|
|
|
|