|
fetch the thread list and suspend all of them.
Don't try it, just do it!
|
|
|
|
|
hi !
Does anybody know how to stop a process without killing it ?
What i needed was that my program hooked windows and get notification when explorer or any other windows component calls FindFirstFile(...)
my application gets a notification message.Now based on certain settings my program must allow FindFirstFile(...) to execute ,or prevent it from execution.I have proceeded till the notification part.Currently the app is notified when FindFirstFile(...) is called.But how do i stop it?
Also the app must be cross platform friendly ...and i don't have DDK so the solution can't be driver based...
Kane
|
|
|
|
|
How can I make a control bar float and dock inside a pane of a CSplitterWnd instead of the CMainFrame???
Doc I have to override CMainFrame DockControlBar() or something?
Thanks
How do I print my voice mail?
|
|
|
|
|
I thought I knew what I was doing, but I can't come up with any way to initialize my static character array. It's defined, in the header file as
static char var[4]; In my source file I have tried every way I know of to give it a value to no avail. Any help is appreciated as I'm sure it can be done, I obviously have no idea how though.
- Aaron
|
|
|
|
|
I am afraid that I would not really understand your idea. But I give you here an example, it may help you.
<br />
class X{<br />
public:<br />
...<br />
private:<br />
....<br />
static char st[4];<br />
....<br />
};<br />
<br />
char X::st[4]="123";<br />
static char ss[4]="abc";<br />
....<br />
|
|
|
|
|
You normally don't put a static global variable in a header file; the purpose of using such a global is to restrict its visibility to one .CPP file.
You can give it an initial value in the .CPP file like so:
static char var[4] = "abc";
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
I even hear the Windows "OMG I booted up fine" sound.
-- Paul Watson diagnosing hardware problems.
|
|
|
|
|
How would that be possible? I would like to access a MySQL database on my site from a program.
Thanks.
Michael
|
|
|
|
|
I have not done that before, but I think you could use ODBC, ADO with MySQL driver for Windows. I've ever used MySQL driver for ODBC to import mySQL data into MS Access.
|
|
|
|
|
Hi all, whenever i need some symbols/constants to be avairable to my entire application (all its files i mean), i create a header file (appconsts.h), and i #include it in each .cpp file of my application. this always worked fine, till recently, i recived some advice to stop using macros (#define) to define constants, and started using const, so (in my current project) i happily went to my appconsts.h file, and changed it like this (an example):
Before:
#if !defined(APPCONSTS_H)
#define APPCONSTS_H
#define MY_STRING _T("a string")
#define MY_NUMBER 100
enum MY_ENUM{En1=0, En2, En3};
#endif
AFTER:
#if !defined(APPCONSTS_H)
#define APPCONSTS_H
const TCHAR* MY_STRING = _T("a string");
const int MY_NUMBER = 100;
enum MY_ENUM{En1=0, En2, En3};
#endif
its all very nice, the only problem is that i now get 708 errors (yes 708), about MY_STRING and MY_NUMBER allready being defined in another object. for example:
ClientEditDlg.obj : error LNK2005: "char const * const COLHT_VLV_NOTES" (?COLHT_VLV_NOTES@@3PBDB) already defined in Boletaje.obj
onfigSheet.obj : error LNK2005: "char const * const IF_FILENAME" (?IF_FILENAME@@3PBDB) already defined in Boletaje.obj
please notice that i DID include guards on the appconsts.h file, i tried removing all the #includes to appconsts.h file, and just including it in my stdafx.h file, but no luck, and since this is a WTL project, i dont have any other file (besides stdafx.h) that gets included everywhere.
Can someone help me out?
***UPDATE***
mhh, i get it now, i should declare the consts in some .cpp file (say where my winmain()is), and then op appconsts.h i should do like this:
extern const TCHAR* MY_STRING = _T("a string");
extern const int MY_NUMBER = 100;
enum MY_ENUM{En1=0, En2, En3};
is this correct?
if so, wouldnt be easyer to just use #define instead of const? i mean, MS uses it! for example in winuser.h:
// ShowWindow() Commands
#define SW_HIDE 0
#define SW_SHOWNORMAL 1
#define SW_NORMAL 1
#define SW_SHOWMINIMIZED 2
#define SW_SHOWMAXIMIZED 3
#define SW_MAXIMIZE 3
...
what you guys think?
|
|
|
|
|
When you change to const s, you are creating global variables. As such, you have to declare/define them differently.
What's happening now is that a.cpp includes appconsts.h and sees MY_STRING is a global variable, so MY_STRING (appropriately name-decorated) goes into a.obj.
Then b.cpp comes along, includes appconsts.h, and sees MY_STRING . Same thing happens, MY_STRING goes into b.obj.
When the linker runs, it collects the obj files into an executable, but sees the multiple definitions of MY_STRING , which breaks the ODR (one definition rule: each symbol must have exactly one definition).
For a quick hack, add __declspec(selectany) to the variable definitions. The real way to solve it is in the FAQ[^]
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
You cannot stop me with paramecium alone!
|
|
|
|
|
Thanks for your answer Michael, i updated the original message before i readed your reply (i guess i was updating it while you were adding the reply , i would appreciate if you read the update and tell me what you think about using #define
|
|
|
|
|
That's still not exactly right. You don't initialize global variables in the header file, but in the .cpp file where they are defined.
appconsts.h:
extern TCHAR* FOO;
appconsts.cpp:
TCHAR* FOO = _T("Hello");
The Windows headers use #define because the API is still a C interface, and const is not supported by all C compilers (it was officially added to C rather recently).
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
There is a saying in statistics that a million monkeys pounding on typewriters would eventually create a work of Shakespeare. Thanks to the Internet, we now know that this is not true.
|
|
|
|
|
Thanks Mike
|
|
|
|
|
I need source code to a program that copies itself into a certain directory like "C:\Program Files" and I want it to have a list of certain names. I got this so far:
void main()
{
char *filenames[] = {"information.exe", "test.exe", "testing.exe"
};
LPCTSTR Destination = ("C:\\Program Files\\");
CopyFile(ModuleFileName, Destination);
}
but I don't know how to copy itself as those filenames.
-Ryan M.
|
|
|
|
|
Sounds like a really amateur virus
Anyway You should issue a call for each name in the filenames
and your void main shouldn't end with a ;
to copy a file you have several options:
i would go for a while (fread()) fwrite style
or even an assembly copy
|
|
|
|
|
Inorder to catch WM_LBUTTTONDBLCLK in MDIClient area I do that:
1.
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)<br />
{<br />
if( !CMDIFrameWnd::PreCreateWindow(cs) )<br />
return FALSE;<br />
return TRUE;<br />
}
added
cs.style|=CS_DBLCLKS;//to response DoubleClick
2.reload PreTranslateMessage(MSG* pMsg)Function:
BOOL CMainFrame::PreTranslateMessage(MSG* pMsg) <br />
{<br />
<br />
<br />
if(pMsg->hwnd==m_hWndMDIClient && pMsg->message==WM_LBUTTONDBLCLK)<br />
PostMessage(WM_LBUTTONDBLCLK);<br />
return CMDIFrameWnd::PreTranslateMessage(pMsg);<br />
}
3.in CMainFrame add
WM_LBUTTONDOWN AND WM_LBUTTONDBLCLK Message_map:
void CMainFrame::OnLButtonDown(UINT nFlags, CPoint point) <br />
{<br />
AfxMessageBox("Left Mouse Down!");<br />
CMDIFrameWnd::OnLButtonDblClk(nFlags, point);<br />
}<br />
void CMainFrame::OnLButtonDblClk(UINT nFlags, CPoint point) <br />
{<br />
AfxMessageBox("Left Mouse DoubleClicked!");<br />
CMDIFrameWnd::OnLButtonDblClk(nFlags, point);<br />
}
:(but all that did'nt work,none messagebox OUT!!
WHY ??????
i wanna learn more @_@!
|
|
|
|
|
Pls help me !
Is there anyone can help me?
sos!!
i wanna learn more @_@!
|
|
|
|
|
If I have a simple program that multiplies a user specified number of integers, how can I get the program to generate the same amount of corresponding, integer data type variables? Or, better said, how do you create null variables during runtime?
|
|
|
|
|
|
I have a class (Named CData), that I want to load up using serveral different dialogs that are launched from CMainFrame.(menu)
The gathered data determines where I proceed in the program. How do I do this with a "un-MFC" class?
Programming! - Isn't it Great!
See you in CyberSpace!
|
|
|
|
|
I know this is easy, but its annoying. I"m trying to a value from within a byte array that I need to cast into a short. Here's what I have and its not working.
short *pnMsgType;
short nMsgType;
int pos = sizeof(FrameHdr) + 1;
pnMsgType = (short *) (&pMsgBuffer + pos);
memcpy (&pnMsgType, (short *) (&pMsgBuffer + pos), sizeof (nMsgType));
Neither the assignment statement or the memcpy is getting me the 2 bytes I need at the position. Any ideas??
-C
|
|
|
|
|
Never mind.. I fixed it, I didnt need the "&" in pMsgBuffer in the assignment statement.
-C
|
|
|
|
|
Hello,
I've an OCX written in MFC, and am trying to use it from a VB Client.
To be able to PostMessage() within my control I need the HWND . Any VB client (as per info on the net), does not support HWND for OLE Controls (my OCX is one!).
My control's "this " has the "hWnd " as 0x00000000 when I use the OCX from a VB Client!
But it properly works from the ActiveX Test Container, or from a VC++ client.
Is this correctable, or am I doing anything wrong?
Thanks,
Rgds,
Nirav Doshi
|
|
|
|
|
if you want HWND to control then use HWND hWnd = GetSafeHwnd();
if you want handle to container use
HWND m_hwndContainer = GetParent()->GetSafeHwnd();
|
|
|
|
|
Pradeep Maskeri wrote:
HWND m_hwndContainer = GetParent()->GetSafeHwnd();
Thanks Pradeep for your reply... But I had already tried this, without help!
* Don't wish it was easier, wish you were better! *
|
|
|
|