|
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
|
|
|
|
|
I have written an app in VB and am trying to rewrite it in VC++. What the app does is work with large text files(up to 30 meg) containing code to drive CNC machines. I ran the wizard to create an exe, I changed the base class to CRichEditView. I added the line CRichEditDoc::m_bRTF = FALSE; to allow it to work with plain text.
I built the base project in release and ran it. The load time for a sample 16.7 meg file is 4 times greater in the VC++ version than it is in the VB version.
Does anyone have any ideas what I'm doing wrong?
Thanks
Bryan
|
|
|
|
|
bgm56 wrote:
Does anyone have any ideas what I'm doing wrong?
Perhaps you are doing nothing wrong. Comparing the running time of a VB application to a VC++ application is not a very fruitful exercise as they are two very different development platforms. Each language has its own strengths and weaknesses, not to mention that each is a different distance away from the underlying machine code depending on what is happening at any given moment.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thanks for the reply.
The intent is not to evaluate which code runs quicker. I noticed the problem when I created the exe and tested the function. The load time was unacceptably long. This is my first C++ project and I'm trying to learn to make it work better than the standard MFC wizard.
I have commercial apps that do similar things that load 50% faster than my VB code and were written in C++, so I know it's possible.
Thanks
Bryan
|
|
|
|
|
bgm56 wrote:
The load time was unacceptably long
Without actually seeing how you are loading the file, it's hard to offer any suggestions.
bgm56 wrote:
I have commercial apps that do similar things that load 50% faster
Perhaps you meant 150% faster. 50% implies twice as long or half as fast.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Again, thanks for the reply.
I guess it's time to pick up some books on MFC and read them instead of this message board. I did try to take a short cut and find someone that knew MFC inside out and give me a quick answer, hard work and study will be the correct answer.
You have helped me though, reaffirmed some long known truths, advice is worth exactly what you pay for it and now matter where you go there are people trying to boost their ego by taking cheap shots at you.
So thanks for the tips. Imagine that, comparing run times between programming languages is fruitless, dang could have knocked me over with a feather when I read that.
50% faster really means slower. Guess technically you are correct, thank you for pointing out the error of my ways.
By the way I sure hope you don't by any products offering you 50% more for free, I'm sure they are trying to screw you. Guess I'm not the only person in this world who uses percentages loosely.
Thanks for making my first post to any such board so informative, it will be my last.
|
|
|
|
|
bgm56 wrote:
I guess it's time to pick up some books on MFC and read them instead of this message board. I did try to take a short cut and find someone that knew MFC inside out...
That's not taking a shortcut. That's just being resourceful.
bgm56 wrote:
...advice is worth exactly what you pay for it...
Which says a lot since this is a free site!
bgm56 wrote:
Thanks...
You are very welcome!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Don't sweat it.
Everybody occasionally tries to take a shortcut and everybody asks "a stupid question". But a stupid answer is just that - sheer stupidity.
The 150% statement is not even technically correct, because you were referring to a differential value, not an absolute value.
50% faster means exactly that, because it is a relative to another speed:
Baseline speed of old app = 1
Baseline speed of new app = 1.5 * baseline speed of old app
Relative %Speed increase = ((1.5 - 1)/1)*100% = 50% *relative* increase in speed = "50% faster".
It is a simple engineering calculation.
But it's no surprise that people can't get it right, because the term "software engineering" itself is a joke. I was trained as a chemical engineer. The cornerstone of ALL engineering fields are definition of standards and application of those standards in practice and especially carefully precise and complete documentation of all aspects of engineering a process.
OTOH, software "engineers" still argue over whether they should have to comment their programs.
Now ... having gotten the (un)cordialities out of the way ... (and no I don't care if that's not even a word and I still misspelled it, LOL)
As to your observation that commercial projects load much faster, I can give you a general answer of one possible reason why that is the case.
Disk operations are slow (relatively speaking, LOL). If you are talking about very large text files being loaded into a rich textbox, my guess would be that most likely what your competitors are doing is loading only a percentage of the total file from disk into memory, then displaying the textbox. Your application is now "loaded" so to speak, displays text, and responds to user interaction.
Meanwhile a background worker thread continues the process of loading the rest of the file from disk.
I can't give you a quick and easy solution on how to do this.
And yes definitely pick up a good resource or two. Maybe try one of Jeffrey Richter's Win32 Programming books - the solution you are looking for is probably less a function of MFC and more of a function of core Windows behavior - threads, memory, disk operations etc.
However I can point you in at least one direction.
Look into Win32 Shared Memory Mapped Files.
They allow threads to read from and write to a common, shared memory space that has been allocated using virtual memory. It requires a little bit of thread synchronization, but in a pretty simple fashion using mutexes and semaphores.
It provides you with a reliable technique to load, say 10% of the file from disk into memory, then into the rich textbox, start your app, and then allow a worker thread to read say, another 10% of the file from disk, then you synchronize and add the additional file data into the textbox, and so forth and so on until the entire file has been read.
Good Luck!
Robert
|
|
|
|
|
Hi,
Thanks for the reply. I have been studying what the problem might be. I have download many code samples to see how they load files and how they behave.
Here's what I found so far.
Using the computer I am writing the app to run on at work ( a Celeron 700), a straight app wizard generated MFC program opening the 16.7 meg text file using serialization takes 47 seconds to completely load the file into the Rich text control.
Using an example I found using the same rich edit control and loading the file through the API, the file loads in just slightly over 30 seconds. A very noticable improvement.
I then found some examples using the scintilla control, which does everything I need.
I found one example using scintilla and MFC and another using it and API. The MFC version opened the file in 15 seconds while the API version opened it in 13. However the API sample did not support MDI so I think the 2 seconds is a good trade.
Thank you for your help and suggestions.
|
|
|
|