|
Hello Nikhil,
Also, when you call CreateThread(), you may pass a pointer to your X instance as follows :
hThread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)(ThreadProc),this,0,NULL);
Note the "this" is passed as the 4th parameter to CreateThread().
Then, in ThreadProc(), you may cast the input parameter back to an X pointer, e.g. :
DWORD WINAPI X::ThreadProc(LPVOID lpParameter)
{
X* pX = (X*)lpParameter;
DWORD dwRet = 0;
return dwRet;
}
Note that because ThreadProc(), although a "global" function, is within the X namespace and so may access the private or protected members of an X instance.
For example :
class X
{
protected :
HANDLE hThread;
private :
int m_i;
public:
X();
protected :
static DWORD WINAPI ThreadProc(LPVOID lpParameter);
};
Note that m_i is "private". But your ThreadProc() function may access X::m_i :
DWORD WINAPI X::ThreadProc(LPVOID lpParameter)
{
X* pX = (X*)lpParameter;
DWORD dwRet = 0;
pX -> m_i = 100;
return dwRet;
}
Hope the above helps, Nikhil.
Best Regards,
Bio.
|
|
|
|
|
|
I am currently working on a graphical program in which I would like to use GDI+ (due to some of the extended functionality). I am a little confused on managing resources in the GDI+ framework. When working w/ MFC will resources such as Pens, Brushes, etc. clean themselves up or do I still have to manually delete these objects?
|
|
|
|
|
does anyone a complete source code for adding, deleting and changing elements in an array in visual C++. Thanks
|
|
|
|
|
|
Hi:
I just reinstalled my system and keep getting an error when I try to debug a DirectShow filter I'm developing. It says "Protection error: debugger detected" and it won't run. I think it's my webcam's filter that won't run, it thinks I'm runnig SoftIce or some cracking software.
Is there a way to avoid this? Any clue?
Thanks,
Aritosteles
|
|
|
|
|
Ok, I found it's not my webcam filter. When I use the RenderFile() method of IGraphBuilder interface the same thing happens. Anyone's seen this?
Thanks,
Aritosteles
|
|
|
|
|
|
Hi!
How can I use one in Visual BASIC developed DLL in Visual C ++?
This DLL contains several classes which I want to use in mine C ++ program. DLL is registered.
At the moment I do the following:
#import "ConvetHTML2WORD.dll"
using namespace ConvertHTML2WORD;
....
....
....
_CConvertHTML2WORDPtr ptrConvert; //CConvertHTML2WORD is a class from a VB6 DLL
HRESULT hr = ptrConvert.CreateInstance("ConvertHTML2WORD.CConvertHTML2WORD");
//"ConvertHTML2WORD.CConvertHTML2WORD" is a registry key in the registry
The CreateInstance does not function.
ptrConvert it remains NULL
what do I do to wrong?
Thnks, Nikolai
|
|
|
|
|
What's the value of hr ?
If you use the hr format in the Watch window (type hr,hr ) the debugger will convert to the symbolic name for you.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
hello
I have a little problem with a dll
I am tying to hook some processes with a variable in a dll.
The variable should hold the names of all the path for the hooked processes. I have shared the variable everything is OK but when I try to initialize it from a file (because I read the entryies from a file) the callback function for the hook runs wild and I do not get the correct modulefilenames. All I get is my program's module filename.
I was wondering what is wrong.
here is a piece of code:
//globals
struct pr<br />
{<br />
char nume[1024];<br />
};<br />
<br />
#pragma data_seg("SHARED")<br />
HHOOK cbt=0;<br />
pr procs[100];<br />
int cnt=0;<br />
#pragma data_seg()<br />
#pragma comment(linker, "/section:SHARED,RWS")<br />
<br />
<br />
LRESULT CALLBACK CallWndProc(int nCode,WPARAM wParam,LPARAM lParam)<br />
{<br />
<br />
if (nCode<0)<br />
return CallNextHookEx(cbt,nCode,wParam,lParam);<br />
<br />
CWPSTRUCT *wps = (CWPSTRUCT*)lParam;<br />
<br />
<br />
DWORD pid;<br />
GetWindowThreadProcessId((HWND)wps->hwnd,&pid);<br />
HANDLE hProc;<br />
hProc=OpenProcess(PROCESS_ALL_ACCESS,FALSE,pid);<br />
HMODULE mods[100];<br />
DWORD size;<br />
char nume[1024];<br />
<br />
<br />
if (EnumProcessModules(hProc,mods,sizeof(mods),&size))<br />
if (size>0)<br />
GetModuleFileNameEx(hProc,mods[0],nume,sizeof(nume));<br />
<br />
<br />
<br />
CreateMutex(0,0,"Pula");<br />
if (GetLastError()!=ERROR_ALREADY_EXISTS)<br />
{<br />
CreateMutex(0,0,"Pula");<br />
FILE *str;<br />
char temp[1024];<br />
GetTempPath(sizeof(temp),temp);<br />
strcat(temp,"\\IdleProcesses.sys");<br />
str=fopen(temp,"a+");<br />
int i;<br />
i=0;<br />
while(!feof(str))<br />
{<br />
i++;<br />
fgets(temp,sizeof(temp),str);<br />
temp[strlen(temp)-1]='\0';<br />
strcpy(procs[i].nume,temp);<br />
<br />
}<br />
fclose(str);<br />
cnt=i;<br />
}<br />
<br />
<br />
<br />
<br />
for (int i=1; i<=cnt; i++)<br />
<br />
<br />
if (StrStrI(nume,procs[i].nume)!=NULL)<br />
{<br />
DWORD exit;<br />
GetExitCodeProcess(hProc,&exit);<br />
TerminateProcess(hProc,exit);<br />
}<br />
<br />
<br />
return CallNextHookEx(cbt,nCode,wParam,lParam);<br />
<br />
}<code>
gabby
|
|
|
|
|
Hello,
I am working with tab controls and I would like to know if when a user selects a tab if you also have to hide the other tabs?
In my example there are two tabs here is the code that i am using the for loop works the code below the for loop does not. the only difference i can see is that in the for loop code i am hiding and showing and the code further down is only showing. does anyone have any comments or suggestions?
TCITEM tcItem;
for(int i = 0; i < m_TabCtrl.GetItemCount(); i++)
{
if (i != m_TabCtrl.GetCurSel())
{
m_TabCtrl.GetItem(i, &tcItem);
m_pDlg = (CMyDlg*) tcItem.lParam;
m_pDlg->ShowWindow(SW_HIDE);
}
}
m_TabCtrl.GetItem(m_TabCtrl.GetCurSel(), &tcItem);
m_pDlg = (CMyDlg*) tcItem.lParam;
m_pDlg->ShowWindow(SW_SHOW);
*pResult = 0;
}
// THIS CODE DOES NOT WORK IT IS SUCCESSFUL IN GETTING THE HWND BUT IT DOES NOT PROPERLY HIDE AND SHOW. I AM CURIOUS TO KNOW WHY I DIDN'T THINK THAT IT WAS NECESSARY TO HIDE THE WINDOWS AS WELL BUT I AM BEGINNING TO THINK THAT IT IS NECESSARY BECAUSE THAT IS WHAT THE CODE ABOVE DOES?
int Index = m_TabCtrl.GetCurSel();
m_TabCtrl.GetItem(Index, &tcItem);
CMyDlg* pDlg = (CMyDlg*) tcItem.lParam;
pDlg->ShowWindow(SW_SHOW);
Thanks,
Lino
|
|
|
|
|
Is it possible to use Visual Studio .Net (7.1) for the generation of Web pages, or is it much better to use something like DreamWeaver. The pages will have quite a bit of I/O controls in them; e.g. buttons, edit boxes etc.
Someone said that you can edit html files (and asp files) in Visual Studio.
I did have a look, but what type of project do you specify if it is possible to have a series of Web pages as a project.
Also whats the difference between html and asp files and does it matter what you use in Visual Studio.
grahamfff
|
|
|
|
|
I use VS6 for all my needs...but just the code editor...nothing WYSIWYG...
It's frustrating being a genius and living the life of a moron!!!
|
|
|
|
|
SetMapMode (hdc, MM_ISOTROPIC) ;
SetWindowExtEx (hdc, 276, 72, NULL) ;
SetViewportExtEx (hdc, cxClient, cyClient, NULL) ;
SetWindowOrgEx (hdc, 138, 36, NULL) ;
SetViewportOrgEx (hdc, cxClient / 2, cyClient / 2, NULL) ;
Can anybody gives me a fully step by step explanation about the codes above, why the logical point (0,0) become the way it is?
Or give me a link to resources that can clarify the "SetWindowExtEx,SetWindowExtEx, SetWindowOrgEx,, SetViewportOrgEx" in much easy understanding way?These problem really bother me a lot!
|
|
|
|
|
/*The Compiler errors is:
fatal error C1070 mismatched #if/#endif pair in file '**/*/****'
hope you can help!*/
#ifndef _WINSOCK2_H
#define _WINSOCK2_H
#define _GNU_H_WINDOWS32_SOCKETS
#ifdef __cplusplus
extern "C" {
#endif
#include <winsock.h>
#define FD_MAX_EVENTS 10
#define FD_READ_BIT 0
#define FD_WRITE_BIT 1
#define FD_OOB_BIT 2
#define FD_ACCEPT_BIT 3
#define FD_CONNECT_BIT 4
#define FD_CLOSE_BIT 5
typedef struct _WSANETWORKEVENTS {
long lNetworkEvents;
int iErrorCode[FD_MAX_EVENTS];
} WSANETWORKEVENTS, *LPWSANETWORKEVENTS;
typedef HANDLE WSAEVENT;
#define WSACreateEvent() CreateEvent(NULL, TRUE, FALSE, NULL)
/* etc */
int WINAPI WSAEnumNetworkEvents(SOCKET s, WSAEVENT hEventObject, LPWSANETWORKEVENTS lpNetworkEvents);
int WINAPI WSAEventSelect(SOCKET s, WSAEVENT hEventObject, long lNetworkEvents);
//ifdef __cplusplus
#endif
#endif
#endif
#endif
#endif
}
|
|
|
|
|
there are too many #endif ...
you need to have one #endif per #if ( or #ifdef or #ifndef )
at the end you should have something like :
#ifdef __cplusplus
}
#endif
#endif
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Thx. It worked on the file but now errors have appeard every were. I have an error in the tchar.h file, atalloc.h. I meen these files
weree made by Microsoft! Whot's happening here!
|
|
|
|
|
check all you other .h files, be certain to match #if ( #ifdef, #ifndef ) with #endif
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
do someone you know where to get sub seven open source
|
|
|
|
|
How do i extract the source code from an .exe file. Is that available throgh the exe format? any links? - Thanks! -V.G
|
|
|
|
|
|
Then how do source code and resource hackers work...? V.G
|
|
|
|
|
Resource 'hacking' is a different story. Windows has a defined interface (UpdateResource [^]) for modifying resources in executables.
Software Zen: delete this;
|
|
|
|
|
V.G wrote:
source code
do u seen any s/w which reveal you source code of application ?
if this possible, then new MSCP Window is coming next month ?
yeah it possible to to hack resource, UpdateResource api will help,but it's work on Win2000 and above plateform only
"I Think Believe this Will Help"
[Vote One Here, Complete my Survey....]
<h5
alok="" gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|