|
-
Jul 16th, 2005, 10:19 AM
#1
What are the best tags for C++ code?
How does the PHP tag look?
PHP Code:
//HookDemo.cpp
#include <windows.h>
#include "WINUSER.H"
/*---------------------------------------------
Shared Variables
This data is shared between both prcesses. The
VB App has access to these variables through the
function SetSharedData
---------------------------------------------*/
#pragma data_seg(".shared")
bool ChangeMessage = false;
int Shared_uMsg = 0;
int Shared_wParam = 0;
int Shared_lParam = 0;
HWND hWndVB = 0; //handle to subclassed VB Window
HWND hWndCtrl = 0;//handle to the window we want to monitor
#pragma data_seg()
#pragma comment(linker, "/SECTION:.shared,RWS")
//---------------------------------------------
// Global Variables, specific to each process
//---------------------------------------------
HHOOK hmsgHooks = 0; // Hook handle for WH_GETMESSAGE
HINSTANCE hInstance; // Global instance handle for DLL
//--------------------------------------------
// DLL entry-point
//--------------------------------------------
BOOL WINAPI DllMain(
HINSTANCE hinstDLL, // handle to DLL module
DWORD fdwReason, // reason for calling function
LPVOID lpvReserved ) // reserved
{
// Perform actions based on the reason for calling.
switch( fdwReason )
{
case DLL_PROCESS_ATTACH:
// Initialize once for each new process.
// Return FALSE to fail DLL load.
hInstance = hinstDLL;//save dll handle for each process
break;
case DLL_THREAD_ATTACH:
// Do thread-specific initialization.
break;
case DLL_THREAD_DETACH:
// Do thread-specific cleanup.
break;
case DLL_PROCESS_DETACH:
// Perform any necessary cleanup.
break;
}
return TRUE; // Successful DLL_PROCESS_ATTACH.
}
Not too bad, I don't like the orange for comments
-
Jul 16th, 2005, 12:12 PM
#2
Re: What are the best tags for C++ code?
You need to grab the Codeguru code highlighter tool Brad has a link in some post somewhere in the Feedback forum.
Code:
//HookDemo.cpp
#include <windows.h>
#include "WINUSER.H"
/*---------------------------------------------
Shared Variables
This data is shared between both prcesses. The
VB App has access to these variables through the
function SetSharedData
---------------------------------------------*/
#pragma data_seg(".shared")
bool ChangeMessage = false;
int Shared_uMsg = 0;
int Shared_wParam = 0;
int Shared_lParam = 0;
HWND hWndVB = 0; //handle to subclassed VB Window
HWND hWndCtrl = 0;//handle to the window we want to monitor
#pragma data_seg()
#pragma comment(linker, "/SECTION:.shared,RWS")
//---------------------------------------------
// Global Variables, specific to each process
//---------------------------------------------
HHOOK hmsgHooks = 0; // Hook handle for WH_GETMESSAGE
HINSTANCE hInstance; // Global instance handle for DLL
//--------------------------------------------
// DLL entry-point
//--------------------------------------------
BOOL WINAPI DllMain(
HINSTANCE hinstDLL, // handle to DLL module
DWORD fdwReason, // reason for calling function
LPVOID lpvReserved ) // reserved
{
// Perform actions based on the reason for calling.
switch( fdwReason )
{
case DLL_PROCESS_ATTACH:
// Initialize once for each new process.
// Return FALSE to fail DLL load.
hInstance = hinstDLL;//save dll handle for each process
break;
case DLL_THREAD_ATTACH:
// Do thread-specific initialization.
break;
case DLL_THREAD_DETACH:
// Do thread-specific cleanup.
break;
case DLL_PROCESS_DETACH:
// Perform any necessary cleanup.
break;
}
return TRUE; // Successful DLL_PROCESS_ATTACH.
}
-
Jul 16th, 2005, 01:43 PM
#3
Re: What are the best tags for C++ code?
OK, let's see how it works
Code:
//HookDemo.cpp
#include <windows.h>
#include "WINUSER.H"
/*---------------------------------------------
Shared Variables
This data is shared between both prcesses. The
VB App has access to these variables through the
function SetSharedData
---------------------------------------------*/
#pragma data_seg(".shared")
bool ChangeMessage = false;
int Shared_uMsg = 0;
int Shared_wParam = 0;
int Shared_lParam = 0;
HWND hWndVB = 0; //handle to subclassed VB Window
HWND hWndCtrl = 0;//handle to the window we want to monitor
#pragma data_seg()
#pragma comment(linker, "/SECTION:.shared,RWS")
//---------------------------------------------
// Global Variables, specific to each process
//---------------------------------------------
HHOOK hmsgHooks = 0; // Hook handle for WH_GETMESSAGE
HINSTANCE hInstance; // Global instance handle for DLL
//--------------------------------------------
// DLL entry-point
//--------------------------------------------
BOOL WINAPI DllMain(
HINSTANCE hinstDLL, // handle to DLL module
DWORD fdwReason, // reason for calling function
LPVOID lpvReserved ) // reserved
{
// Perform actions based on the reason for calling.
switch( fdwReason )
{
case DLL_PROCESS_ATTACH:
// Initialize once for each new process.
// Return FALSE to fail DLL load.
hInstance = hinstDLL;//save dll handle for each process
break;
case DLL_THREAD_ATTACH:
// Do thread-specific initialization.
break;
case DLL_THREAD_DETACH:
// Do thread-specific cleanup.
break;
case DLL_PROCESS_DETACH:
// Perform any necessary cleanup.
break;
}
return TRUE; // Successful DLL_PROCESS_ATTACH.
}
Pretty cool, thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|