|
Probably what you mean is if atleast one application instance
is running ?
What you need is to just enumerate the process list
and look at the exe or the program name.
Process32First, Process32Next.
|
|
|
|
|
Thanks,I'll take alook at them.
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
Is there any way that I can find out I'm connected to internet or not in my application?
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
I've already answered this question, but here is it again:
#include <ras.h>
bool IsConnected()
{
LPRASCONN TRasCon;
RASCONNSTATUS Tstatus;
DWORD lg;
DWORD lpcon;
bool lReturn;
TRasCon->dwSize = 412;
lg = 256 * TRasCon->dwSize;
lReturn = false;
if( RasEnumConnections(TRasCon, &lg, &lpcon) == 0 )
{
Tstatus.dwSize = 160;
RasGetConnectStatus(TRasCon->hrasconn, &Tstatus);
lReturn = ( Tstatus.rasconnstate == 0x2000 );
}
return( lReturn );
}
But this time I will say it's not my code!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Thanks Rickard.
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
You must also want to try InternetGetConnectedState.
|
|
|
|
|
Hello, folks,
I am looking for a Win32 API to do disk formatting, i.e, formatting hard disk to FAT or FAT32 or NTFS format.
What Win32 API should I use ? Anybody know ?
Thanks ! Any response would be appreciated !
|
|
|
|
|
Sorry, I never really got down to that level
Good luck!
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Say I'm creating an MFC-based MDI application with Document-View architecture. When I compile and run the basic code provided by the AppWizard, I get a main frame with a new document child frame already open in the main frame. But my program will not have support for ID_FILE_NEW. I only want the user to be able to load pre-existing documents. How do I prevent the program from starting with a new empty document?
|
|
|
|
|
You can normally use this in your Apps InitInstance
// stop a new document being created if just run normally
if (cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew)
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing ;
just before the call to ProcessShellCommand()
Roger Allen
Sonork 100.10016
In case you're worried about what's going to become of the younger generation, it's going to grow up and start worrying about the younger generation. - Roger Allen, but not me!
|
|
|
|
|
Go to your app's InitInstance() method and comment out this bit of code:
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
if (!ProcessShellCommand(cmdInfo))
return FALSE;
he he he. I like it in the kitchen! - Marc Clifton (on being flamed)
Awasu v0.4a[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Hi everyone. Now I know how to select a row in code, so here is another similar question. I have a listview on a dialog, and the first row in the list view is selected on oninitdialog (there is always entries in the list view). Problem is, I don't want the list view to deselect the row if the user clicks whitespace (such as blank area below the last row in the list view). Usually the listview deselects any rows when this whitespace is clicked. I tried the following code, the idea being keep the last row selected before whitespace was clicked, so in effect you can never deselect a row:
<br />
void CMyDlg::OnClickLvwEmails(NMHDR* pNMHDR, LRESULT* pResult) <br />
{<br />
<br />
iSelected = m_lvwEMails.GetNextItem(-1, LVNI_SELECTED);<br />
if(iSelected == -1)<br />
{<br />
m_lvwEMails.SetItemState(m_iPreviouslySelectedItem, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);<br />
}<br />
else<br />
{<br />
m_iPreviouslySelectedItem = iSelected;<br />
}<br />
*pResult = 0;<br />
}<br />
This seemed to work, except when the user clicks on the list view in the exact same spot twice with the mouse. Then the last row highlighed would be deselected. But if you click different areas in the whitespace, it keeps the last selected row selected. Anyone know a better way to do this? Thanks!
|
|
|
|
|
Anonymous wrote:
except when the user clicks on the list view in the exact same spot twice with the mouse
Perhals it is because in that case the notification message send to the dialog is not the same, like a double click or LVN_BEGINLABELEDIT/LVN_ENDLABELEDIT ?
I hurt so bad inside
I wish you could see the world through my eyes
It stays the same
I just wanna laugh again
|
|
|
|
|
i am working a VC++ graphics project which is not having
any browse information. If i make changes (selecting Browse info from settings,& build project) it gives me error
as
Error executing bscmake.exe.
what are the posiible problems & solutions.
also if project is ported from vc5.0 to vc 6.0
browse info file gives problem?
pls help me
|
|
|
|
|
i want to create a plug in in vc++ for internet explorer..can it be done and how?please help..
himanshu
|
|
|
|
|
Check Google for "Browser Helper Object", I don't have any special link in mind now
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I have a question:
what is the difference bettwen DECLARE_DYNCREATE(CCtrlView) and DECLARE_DYNAMIC(CView).
when and where to use them?
thanks
|
|
|
|
|
Both macros are adding the ability to query runtime information with CObject::IsKindOf for the classes. But only classes declared with DECLARE_DYNCREATE are enabled to be created by CRuntimeClass::CreateObject. Normally all views used inside the "MFC-Document-View-Architecture" were created by the framework by a call to CRuntimeClass::CreateObject.
Hope this helps.
Best regards
Holger Persch
|
|
|
|
|
Hello,
I am relatively new to programming for windows, so bear with me. I am trying to write a program that will read class members from a file and store them in an STL vector. Once that is complete, I would like to have a dialogue with various buttons that will perform operations using the members of that vector.
My question, though, is this: Is there any way to have a single instance of the vector that all of the Buttons' functions can have access to? Should it be a global variable? If so, how does one declare a global variable in VC++6?
Thank you
|
|
|
|
|
Globals are pretty much always a bad idea. If you put your vector into the dialog/window class, that is where you're going to handle click events for your buttons anyhow.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
|
GREETINGS!
I need an advice. I need to create an object or a simple structure with some dynamic arrays. Should i use CArray class for it, and shall i have the problems with serialization and saving this object? Or is there another way?
Thank YOU.
Good luck!
LOVE & PEACE to everyone
|
|
|
|
|
Unless you have pressing reason to use CArray, you should use std::vector, which is much more powerful.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
I agree with Christian. std::vector owns! Check out my article, CDataFile[^] for use of it, and reading from a file. I will have an updated version soon that will write to CSV also. But you can use standard serialization if you want.
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Thank you for help.
LOVE & PEACE to everyone
|
|
|
|