Initial Commit
This commit is contained in:
92
common/INSTANCE.HPP
Normal file
92
common/INSTANCE.HPP
Normal file
@@ -0,0 +1,92 @@
|
||||
#ifndef _COMMON_INSTANCEDATA_HPP_
|
||||
#define _COMMON_INSTANCEDATA_HPP_
|
||||
#ifndef _COMMON_WINDOWS_HPP_
|
||||
#include <common/windows.hpp>
|
||||
#endif
|
||||
|
||||
class InstanceData
|
||||
{
|
||||
public:
|
||||
InstanceData(void);
|
||||
~InstanceData();
|
||||
static void FAR *getInstanceData(HWND hPropertyWnd);
|
||||
static void setInstanceData(HWND hPropertyWnd,void FAR *lpPointer);
|
||||
static void removeInstanceData(HWND hPropertyWnd);
|
||||
private:
|
||||
InstanceData(const InstanceData &someInstanceData);
|
||||
};
|
||||
|
||||
inline
|
||||
InstanceData::InstanceData(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
inline
|
||||
InstanceData::InstanceData(const InstanceData &/*someProperty*/)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
inline
|
||||
InstanceData::~InstanceData()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef __FLAT__
|
||||
inline
|
||||
void FAR *InstanceData::getInstanceData(HWND hPropertyWnd)
|
||||
{
|
||||
if(!::IsWindow(hPropertyWnd))return (void FAR*)0;
|
||||
return (void FAR*)::GetProp(hPropertyWnd,(LPSTR)"INSTANCEDATA@@NEARPTR");
|
||||
}
|
||||
|
||||
inline
|
||||
void InstanceData::setInstanceData(HWND hPropertyWnd,void FAR *lpPointer)
|
||||
{
|
||||
if(!::IsWindow(hPropertyWnd))return;
|
||||
::SetProp(hPropertyWnd,(LPSTR)"INSTANCEDATA@@NEARPTR",(HANDLE)lpPointer);
|
||||
return;
|
||||
}
|
||||
|
||||
inline
|
||||
void InstanceData::removeInstanceData(HWND hPropertyWnd)
|
||||
{
|
||||
if(!::IsWindow(hPropertyWnd))return;
|
||||
::RemoveProp(hPropertyWnd,(LPSTR)"INSTANCEDATA@@NEARPTR");
|
||||
return;
|
||||
}
|
||||
#else
|
||||
inline
|
||||
void FAR *InstanceData::getInstanceData(HWND hPropertyWnd)
|
||||
{
|
||||
HANDLE handleSegment;
|
||||
HANDLE handleOffset;
|
||||
|
||||
if(!::IsWindow(hPropertyWnd))return (void FAR*)0;
|
||||
handleSegment=::GetProp(hPropertyWnd,(LPSTR)"INSTANCEDATA@@HIWORD");
|
||||
handleOffset=::GetProp(hPropertyWnd,(LPSTR)"INSTANCEDATA@@LOWORD");
|
||||
return (void FAR*)(MK_FP(handleSegment,handleOffset));
|
||||
}
|
||||
|
||||
inline
|
||||
void InstanceData::setInstanceData(HWND hPropertyWnd,void FAR *lpPointer)
|
||||
{
|
||||
if(!::IsWindow(hPropertyWnd))return;
|
||||
::SetProp(hPropertyWnd,(LPSTR)"INSTANCEDATA@@HIWORD",(HANDLE)FP_SEG(lpPointer));
|
||||
::SetProp(hPropertyWnd,(LPSTR)"INSTANCEDATA@@LOWORD",(HANDLE)FP_OFF(lpPointer));
|
||||
return;
|
||||
}
|
||||
|
||||
inline
|
||||
void InstanceData::removeInstanceData(HWND hPropertyWnd)
|
||||
{
|
||||
if(!::IsWindow(hPropertyWnd))return;
|
||||
::RemoveProp(hPropertyWnd,(LPSTR)"INSTANCEDATA@@HIWORD");
|
||||
::RemoveProp(hPropertyWnd,(LPSTR)"INSTANCEDATA@@LOWORD");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user