|
This[^] is a good starter guide to network programming with sockets.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hello
How to use f1 as hotkey ?
Jalsa
|
|
|
|
|
By pressing it. More info here[^]
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
if ( GetAsyncKeyState ( VK_F1) & SHRT_MAX )
puts ( "F1 key is pressed" );
Jalsa
|
|
|
|
|
Why can't you give some information that may help the people who attempt to answer your query?
What kind of application is it? (I've to guess it by looking at puts )
What are you trying to achieve? Add help to your application?
Or just trap the F1 key? Where do you want to be notified? Only in your app or anywhere?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
You need to else statement?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
|
Hi all,
I have made a function and every time i execute that function its execution time increases(i.e if i don't close my exe and executes it. its excution time increases every time)... But if i close my exe its execution time remains normal.....
I am not getting why this is happening. Can anybody help me in this....
Thanks in advance
|
|
|
|
|
What does that particular function do? The "exe" you're talking about is the one which has this function in it or it is something external?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
may be possiable memory leak
|
|
|
|
|
All sorts of possible explanations. Without knowing something about the function, it's impossible to offer specific comments.
There are many things the function could be waiting for (eg completion of an asynchronous I/O operation, files to be created by another program, mutexes to be released, critical sections to be released, completion of another program). It's possible the first call to the function may be initiating some wider action, and subsequent calls are waiting for that action to complete.
|
|
|
|
|
Can you more explain about pointers that you used in your program?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
can u display the function code
|
|
|
|
|
But I cant see his monitor.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Hamid. wrote: But I cant see his monitor.
Spy eye can help!
"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
|
|
|
|
|
But I use of it at the other place how could you discover it?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
don't know.. what about programming it again
|
|
|
|
|
Hi Guys,
What's up!!!
I'm trying to figure out how to get the desktop resolution of the active user from the system account.
The situation is something like this -
I have a custom print processor (One of the print spooler components) that runs in the context of the SYSTEM account. I need to get the desktop resolution of the user who gave the print command in order to do some image processing on an EMF file. So it doesn't matter how many users have logged-in to the machine.
I tried using WTSEnumerateSessions /WTSQuerySessionInformation . This only works if you are using a remote session (mstsc.exe) and not for a normal session.
My alternate solution for this would be to spawn some process in the user context (Don't know how) and get the desktop resolution to the registry from where it could be read in the SYSTEM context.
But I was wondering if there was a cleaner way to achieve this.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Im in two minds/tracks of thought ..
1 goes .. use EnumDisplayDevices, EnumDisplaySettings, the other goes get/use WinSta0 and get the user session/desktop through that, but, Im begining to think thats useless/impractical
sorry ..
|
|
|
|
|
I am currently working on an application using C++ and MFC. The current state of my Menu's is that they are pull down only. That is, there are no icons on the top of the window. I would like to add icon's to the top of my window. What is the best way of doing this? Can the standard class CMenu do this? Does it make sense to use the class CMFCMenuBar?
Bob
|
|
|
|
|
BobInNJ wrote: That is, there are no icons on the top of the window
Do you mean there's no toolbar[^]?
If so, you probably want a CToolbarCtrl[^]. You probably want to look at this page[^] as well.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I have Visual Studio 2005. I'm doing some console programming and developing a virtual computer store. I have a few problems.
1.) Why do I get these warnings?
Warning 1 warning C4996: 'strcat' was declared deprecated f:\testing\testing\testing.cpp 22
Warning 2 warning C4996: 'strcpy' was declared deprecated f:\testing\testing\testing.cpp 26
2.) You have to enter a password in the beginning of the program in order to access the store. I have it set up so that it tells the user that the password is incorrect. It used to display that if the user did indeed put in the wrong password but it would still let the user move onto the store. So to stop that, I added the line "return 0;" in the else condition. The problem is that it now exits out of the program without even letting the user see that the password was incorrect. What would be a better solution?
3.) I've noticed that in the first question if my if condition is true, it still moves onto my switch method question. I want it to stop.
Here is my code:
#include "stdafx.h"
#include "iostream"
using namespace std;
int main(){
char Password[50];
int a;
int b;
int c;
int d;
cout << "Type in the password to enter this promotional store of great savings.\n";
cin.getline(Password,50,'\n');
if (!strcmp(Password,"savings"))
{
strcat(Password," is the correct password!\n");
}
else
{
strcpy(Password,"That's not the correct password!\n");
return 0;
}
cout << Password;
cout << "Welcome to PC Warehouse\nHow much are you willing to spend?\n";
cin >> a;
if (a < 800){
cout << "Get out!\n";}
else {
cout << "How much RAM?\n";
cin >> b;}
if (b < 512){
cout << "I hope you're not planning on running Vista!\n";}
else {
cout << "Ok...how much HDD space?\n";
cin >> c;}
cout << "Ok, which videocard do you want?(Enter the number)\n1 Radeon X1600\n2 GeForce 8800\n3 Radeon HD 2600 XT\n";
cin >> d;
switch (d){
case 1:
cout << "Going cheap, no problem.\n";
break;
case 2:
cout << "Now we're talking...\n";
break;
case 3:
cout << "ooooof, you're going to need some power\n";
break;
default:
cout << "Invalid answer. Type in only the number of the corresponding videocard!\n";
break;
}
system("pause");
}
|
|
|
|
|
Under the rules of C++ all functions must be declared or defined before use. In the case of strcat,
you did not declare or define it. Under the old rules of C, if a function was not declared or
defined then the compiler assumed that it returned int. They way I would declare strcat, since it is a standard header file is to include the header file: string.h. Inside that header file there should be a declaration for strcat. There is a similar issue for strcpy.
To address the second issue, you might want to use a while loop. For example, your code might look
like the following:
<br />
bool validPassword = false;<br />
while ( validPassword == false ) {<br />
read password<br />
if password is correct then<br />
validPassowrd = true;<br />
else {<br />
put up error message<br />
}<br />
}<br />
Now, what I wrote about is not valid C++ but it should give you an idea of how you might restructure your program. I hope this helps. Feel free to ask a follow up question.
Bob
|
|
|
|
|
Ryuk1990 wrote: 1.) Why do I get these warnings?
Warning 1 warning C4996: 'strcat' was declared deprecated f:\testing\testing\testing.cpp 22
Warning 2 warning C4996: 'strcpy' was declared deprecated f:\testing\testing\testing.cpp 26
Because Microsoft decided they were unsafe and you should use strcat_s[^] and strcpy_s[^] instead. See this page[^] for even more detail.
Ryuk1990 wrote: 2.) You have to enter a password in the beginning of the program in order to access the store. I have it set up so that it tells the user that the password is incorrect. It used to display that if the user did indeed put in the wrong password but it would still let the user move onto the store. So to stop that, I added the line "return 0;" in the else condition. The problem is that it now exits out of the program without even letting the user see that the password was incorrect. What would be a better solution?
Replace
strcpy(Password,"That's not the correct password!\n");
with
cerr << "That's not the correct password!\n";
I'd also replace this
strcat(Password," is the correct password!\n");
with
cout << Password << " is the correct password!\n";
and get rid of this
cout << Password;
Ryuk1990 wrote: 3.) I've noticed that in the first question if my if condition is true, it still moves onto my switch method question. I want it to stop.
Put a return 0; after this line:
cout << "Get out!\n";}
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I'm coding in C++ on Visual Studio 2005. I was working on a dialog-based MFC program the other night. I just opened it and I can't figure out how to view the design. I remember in VB.NET you just had to go to the top, select view, and then select view design. I don't see an option for that on C++.
|
|
|
|