|
Hi everyone,
Using: VC++ .NET
My project involves sending a message from one computer to another.
I am using CSocket as the connection between these two computers. On the computer that receives the message, I am using the CSocket.Receive method to receive the incoming message. I have made it working, but somehow, I discover that when I call the Receive method on the receiving computer, the program 'hangs' (i.e. the form cannot move) until it actually receives the message. Is there in anyway helps to prevent this (the program does not 'hang', while still trying to receive a message)?
My client code goes something like this:
CSocket client;
client.Create();
client.Connect(ip,port); // ip and port have been specified before
client.Receive(&msgLength, 4); // i believe the program 'hangs' here until it gets something.
BYTE* msgByte = new BYTE[msgLength];
Thank you and your answer is greatly appreciated.
|
|
|
|
|
Hi,
I seem to be having a problem including a new class in my project.I have a separate file called calc.cpp/h to include the CCalc class.
But when i do the necessary things and compile/build it,then it gives me some class type redifinition error of some three different classes.
How do I remove this class type redifinition error and what could be the possible causes.
As soon as i include this class in any other file in my proj,then it gives the error saying class type redifinition of three other classes.
thanks,
Arjun
Arjun Mukherjee
Software Engineer
Hewlett Packard
|
|
|
|
|
it is common problem with c++ when you include same header file in two file and these two file including each other.
one possible solution is to declare you class header file this way.
#ifndef MY_HEADER_FILE
#define MY_HEADER_FILE
includes
...................
your class declartion
...................
#endif
this will gurantee inclusion of your class only one time.
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
Hi Alok,
I have already done that,but I get that error anyway.This class type redifinition that i get is not for the new class(CCalc) that i included,but for some three other classes.
But,the error that I get is not for this class it is for some three other classes,and this error arises only when I use the include directive(#include<calc.h>).
c:\arjMuMS\NewEng\BackupNewMumsEngine\Vars.h(19): error C2011: 'CVars' : 'class' type redefinition
This is the error it gives me,I have a variable of CVars type declared and used in CCalc class.But i cannot figure out the problem.
thanks,
Arjun.
Arjun Mukherjee
Software Engineer
Hewlett Packard
|
|
|
|
|
maybe CVars is a class that already exist in the compiler's library...
you'd better define your class with a name you're certain that none already use it...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I am currently creating an application which requires to launch an application in backgroud and the user should not be able to see the application window. I am using CreateProcess API to launch the application in background and using the STARTUP_INFO structures's flag (STARTF_USESHOWWINDOW)to hide the newly launched application's window. But by doing this though the application is launched in background and is not visible to the end user the splash screen of the application is visible to the end user. I have tried manipulating few flags of STARTUP_INFO structure but it didnt helped. I am looking for any alternative way by which i can accomplish the aforesaid task or any usefull information????
Parag Jhavery
|
|
|
|
|
You might not be able to; if the application is coded to create and show a splash screen. However, most MFC applications pay attention to the /Embedding command line parameter and will not show the splash screen (and will remain invisible) under those circumstances. Have you tried contacting the developer of the application to ask them if they support something like a /nologo or /nosplash command line parameter?
If you wanted to get fancy, you could try two other things: launching the application on another, non-visible desktop, but you might have to figure out new ways to interact with it, or install a short-term hook (you will need to create a DLL for this) that can catch and "pop" the splash screen.
Peace!
-=- James
Tip for inexperienced drivers: "Professional Driver on Closed Course" does not mean "your Dumb Ass on a Public Road"! Articles -- Products: Delete FXP Files & Check Favorites
|
|
|
|
|
Hello,
How do i keep my Dialog Box always full screen?
My dialogbox class is not inherited from CDialog
class but CDialogBar class. It doesn't support
OninitDialog. Kindly answer my question.
Regards
Deepali
|
|
|
|
|
overide WM_GETMINMAXINFO or WM_size message,read more abt them in your local copy of msdn.
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
how to get network serial port emulation ?????
i want to get serial port information.
can i get?
i want to get this serial port is usable or unuseable?
|
|
|
|
|
Hi all;
I want to set a number for a function for example:
19928=myfunc();
and then by calling this number...
2:is there any way to have a handle to a process by giving
it's name?
Thanks.
|
|
|
|
|
why do you want this for ??
you cannot do that.
however, if you have many functions that may be called depending on an index, you could set them in a pointer-to-functions array...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
dSolariuM wrote:
I want to set a number for a function for example:
19928=myfunc();
and then by calling this number...
This makes no sense. Please explain further.
dSolariuM wrote:
2:is there any way to have a handle to a process by giving
it's name?
There might be another way, but the one I am thinking of uses Process32First() to get a list of running processes. Look through that list of processes until you find the one of interest. At that point you will have its process id and module id.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi
I am writing an application which needs to know if the user is having internet connection enabled or not.
I want this checking to be done automatically by the application, I donot want to pop up connect internet dialog.
Can anyone tell me if there is any API/function to findout that the machine is having internet connection.
Regards,
Ruchirdhar Dwivedi
RuchirDhar Dwivedi
Software Engineer
Windowmaker Software Pvt.Ltd.
Baroda, India.
|
|
|
|
|
mr ruchir use his api
InternetGetConnectedState
This function retrieves the connected state of the local system.
BOOL InternetGetConnectedState(
LPDWORD lpdwFlags,
DWORD dwReserved);
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
InternetGetConnectedState() only works for modem connections. It will return FALSE even if the user is connected via a network. The only truly correct method of knowing is by actually trying to connect to a known website. If it works, then you're connected. If it doesn't work, then you're probably not connected (not definitely - the website might be down).
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
small question Sir!, then what is meaning of INTERNET_CONNECTION_LAN in above api
thanks
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
Hey
I was just searching on the MSDN and I got something WinInet API's in which there is function InternetOpen(...) will it help me??
I mean just checking handle (if null then no internet, if not null internet available.)
Do anyone has any idea about this WinInet API and tell me whether it will help me??
Regards.
RuchirDhar Dwivedi.
RuchirDhar Dwivedi
Software Engineer
Windowmaker Software Pvt.Ltd.
Baroda, India.
|
|
|
|
|
RuchirD wrote:
function InternetOpen(...) will it help me??
i don't think soo,as msdn state that "This function initializes an application’s use of the Windows CE Internet functions." the equivalent function for windows is InternetOpenUrl().
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
This function initializes an application’s use of the Windows CE Internet functions."
I think there is some confusion. Windows function call InternetOpenURL uses Handle that is returned by the function call InternetOprn(...)
Pls see below
InternetOpenUrl
Opens a resource specified by a complete FTP, Gopher, or HTTP URL.
HINTERNET InternetOpenUrl(
HINTERNET hInternet,
LPCTSTR lpszUrl,
LPCTSTR lpszHeaders,
DWORD dwHeadersLength,
DWORD dwFlags,
DWORD_PTR dwContext
);
Parameters
hInternet
[in] Handle to the current Internet session. The handle must have
been returned by a previous call to InternetOpen
Plz correct me if I am wrong.
What I could conclude from the MSDN excerpt is that "InternetOpen returns handle to the internet session if connected and if not it will return null, using this handle we can open an URL using InternetOpenURL() function".
Also the exact use case is "check if user is connected to the internet".
Thanks n Regards
RuchirDhar Dwivedi.
RuchirDhar Dwivedi
Software Engineer
Windowmaker Software Pvt.Ltd.
Baroda, India.
|
|
|
|
|
RuchirD wrote:
Windows function call InternetOpenURL uses Handle that is returned by the function call InternetOprn(...)
Yeah you are RIght!,Sorry i Interpreted it wrong.
RuchirD wrote:
What I could conclude from the MSDN excerpt is that "InternetOpen returns handle to the internet session if connected and if not it will return null, using this handle we can open an URL using InternetOpenURL() function".
InternetOpen according to MSDN "InternetOpen is the first Win32 Internet function called by an application. It tells the Internet DLL to initialize internal data structures and prepare for future calls from the application."
So it just Initializing the Local Variable ONly , not checking the State of Internet.i.e. you can simulate the use of Internet api using LOCAL WebServer .
But InternetGetConnectedState return with actual Internet State.
TRY IT!
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
Hi Thanks for information.
I m Still having some doubt and some confusion.
Coming to doubt:-
I want to know whether user is connected to the internet it should not be application's concern that user is connected to the internet via LAN/PROXY/DIALUP. How to do that??
(connected to internet means connection is esatblished not just that internet is configured.)
Coming to Confusion:-
As you said that the
InternetOpen according to MSDN "InternetOpen is the first Win32 Internet function called by an application. It tells the Internet DLL to initialize internal data structures and prepare for future calls from the application."
but in the description of InternetOpen they say
InternetOpen
For a general utility or application, you should start with the InternetOpen function. By specifying the Internet agent you want to do the Internet access (for example, Microsoft Internet Explorer), the type of access you want, and a few optional flags, this function returns you a handle to an Internet session. When you are finished with the connection, you must close it by passing the handle to the InternetCloseHandle function. For example:
HINTERNET hInternetSession;
hInternetSession = InternetOpen(
"Microsoft Internet Explorer", // agent
INTERNET_OPEN_TYPE_PRECONFIG, // access
NULL, NULL, 0); // defaults
.
.
.
InternetCloseHandle(hInternetSession);
This will make a connection to the Internet, using the Internet agent "Microsoft Internet Explorer," and return a handle to the connection, if successful. By specifying the parameter INTERNET_OPEN_TYPE_PRECONFIG, you have requested the agent to use certain values that are stored in the registry. The rest of the parameters are set to use the default configurations. In one simple call, you have made a connection to the Internet—assuming nothing went wrong with the connection, of course! With the returned hInternetSession handle used as a parameter to the other functions, you can start accessing Internet information.
So Which one to prefer and am I interpreting correct that this call will make connection and return internet session as handle.
RuchirDhar Dwivedi
Software Engineer
Windowmaker Software Pvt.Ltd.
Baroda, India.
|
|
|
|
|
|
See here.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I've seen a number of apps lately that have a tab control in the About dialog. At least one of the tabs will have links to email and check for updates. I know how to add a tab control but I thought for the About dialog to use links, it had to be derived from CDHtmlDialog? That's what I use to create mine so that I can have such links but when I try adding a tab control to it, the tab control is layered on top of the html section so that they are two different dialogs. Does anyone know how to do this or where I can find an example?
Jack
|
|
|
|