|
Where should i put this handler in an MDI application. I have put it in the CframeWnd class but it gives error "overload function differs only by return type??
UINT CMainFrame::OnNcHitTest(CPoint point)
{
CRect rc;
GetClientRect(&rc);
ClientToScreen(&rc);
return rc.PtInRect(pt) ? HTCAPTION : CFrameWnd::OnNcHitTest(pt);
} what to do know
|
|
|
|
|
If you are compiling this code in VS2005 or later (which it sounds by the error given) then change the return type to LRESULT. Starting with VS2005 they changed the function signature from UINT to LRESULT.
Kelly Herald
Software Developer
|
|
|
|
|
Hello friends,
I am using MAC address to implement licensing in my application. As far as I know, MAC address of every system is unique and is very commonly used for licensing purpose.
For giving license of my application, I generate a unique key based on MAC address of a particular system and send that key to the customer. But the problem is that every time I format my system, I get a different MAC address. Doing this is problematic as every time customer format his system, he will need a new key (as his MAC address will also change on formatting his system).
Another problem is that if someone have two OS say XP and VISTA on his machine, he'll need two different keys to activate the license on both of the OS.
What I want, I get same MAC address even though customer keep on formatting his system (so that he can use same key every time). Also I get same MAC address on all the Operating Systems on a single machine (so that he can use same key on all the Operating Systems on his machine). Is it possible to do so? If yes then how? If not then why not? Please help me.
Right now I am using below code to get MAC address of a system:
std::string strMACAddress;
try
{
PIP_ADAPTER_INFO pAdapterInfo = NULL;
ULONG ulOutBufLen = sizeof (IP_ADAPTER_INFO);
pAdapterInfo = new IP_ADAPTER_INFO();
if (pAdapterInfo == NULL)
{
return;
}
int iResult = GetAdaptersInfo(pAdapterInfo, &ulOutBufLen);
if ( iResult == ERROR_BUFFER_OVERFLOW )
{
delete pAdapterInfo;
pAdapterInfo = new IP_ADAPTER_INFO[ulOutBufLen];
if (pAdapterInfo == NULL)
{
return;
}
}
if ( iResult != ERROR_SUCCESS )
{
iResult = GetAdaptersInfo(pAdapterInfo, &ulOutBufLen);
if ( iResult != ERROR_SUCCESS )
{
delete pAdapterInfo;
pAdapterInfo = NULL;
return;
}
}
strMACAddress = pAdapterInfo->AdapterName;
delete pAdapterInfo;
pAdapterInfo = NULL;
}
catch (...)
{
}
Thanks in advance,
Best Regards
Aseem
|
|
|
|
|
At the end of the day you're only querying a software function that returns the MAC address of the NIC.
So as long as the TCP drivers all query the same software function, you can use either the actual MAC address, or an arbitrary one - so long as the software function can return (a) the hardware encoded address and
(b)some other arbitrary value.
In fact, using only the MAC of the NIC is one of the laziest, sloppiest (and most easily defeated) licensing schemes I can think of.
You bigger problem is the fact that one copy of the software (and it's MAC-specific key) can be freely given to and used by anybody that is inclined to change their MAC address to suit the registration key. Been there done that, still got the t-shirt.
http://www.klcconsulting.n[^]Here's some quick tidbits:http://www.klcconsulting.net/Change_MAC_w2k.htm
Pulling serial numbers from Motherboards & HDDs are typically more effective - This is what ZBrush 3.0 used to use.
But seriously, if your product is worth protecting it's worth spending a couple of $100 on isn't it?
You're far better off using a commercial protector that utilizes a virtual machine and obfuscates the machine code at the same time.
Armadillo was(is) a pretty good exe packer/encryptor/anti-debugger (http://www.siliconrealms.com/)
ASPack is also a b**tard to reverse engineer.
VmProtect is one nasty piece of work. Virtual machine and obfuscation (http://www.vmprotect.ru/)
The point is - these folks spend their working weeks coming up with protections schemes. You spend it coming up with the app.Would you service your own car if you kinda had a vague idea of what you were doing, while you knew you could afford to pay somebody that knew all of the idiosyncrasies of the particular model and any little tricks and tips for dealing with them??
If it's worth protecting - I'd suggest you do it properly.
|
|
|
|
|
Hi friend,
Thanks for reply. Yeah, you are right in that one should use third party licensing libraries. But my software is very cheap. It would cost around 5-8 dollars per license. Also I don't know if I could capture the market. So cannot afford to buy any licensing scheme.
But yes, as you said licensing based on MAC address is not a good approach. Can you help me in how get serial number of mother board?
3-4 months back, I did try to get serial number of mother board using WMI. But I could not do so. If you can provide some sample code about how to get serial number of mother board using any other mean (but using C++ only)?
Regards
Aseem Sharma
|
|
|
|
|
Is there any reason why you are using the AdaptorName member of PIP_ADAPTER_INFO rather than the Address member?
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
Actually I found that Address member on many machines comes as an empty string. But it was AdaptorName member of PIP_ADAPTER_INFO which return the string such as "4960B27D-C24F-4C8B-886E-4E6BB93913C4".
|
|
|
|
|
When I debug a windows program, at program exit, when I attempt to step over the function ExitProcess(), the debugger catches an access violation exception. The code below is from the C run-time source.
void __cdecl __crtExitProcess (
int status
)
{
__crtCorExitProcess(status);
ExitProcess(status);
}
When I build and run a release version, the program appears to end properly and no errors are reported, but code that is waiting for the process to end
dwReturnCode = WaitForProgramToComplete(strProgramName, strProgramParameters);
results in the dwReturnCode now having the value of C0000005 instead of the value of 0. The fact that this number corresponds to the same value for the access violation exception when I debug, makes me suspect that the exception is still being thrown and handled a little differently. Does anoyone have some ideas on how to best try to determine the cause of this problem. Thanks.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
Can you enable the exceptions ?
(Menu : Debug->Exceptions ... )
Watched code never compiles.
|
|
|
|
|
When I enable the access violation exception (under Win32 Exceptions), the exception is caught, but there is no source code to break into. I open the disassembly window and it displays all the assembly code, but I'm not able to discern anything from that.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
hello, I have a document for teachers, however I speak English poorly (I'm from Vietnam) you can open the attached documents below and tell me the assignment to the requirements of the problem is not ?
http://www.mediafire.com/?ugzoc8g1j8d22hu[^]
|
|
|
|
|
It is unlikely that anyojne will download your file. Secondly if this is a school assignment you are expected to do the work, nobody here is going to do it for you.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
hello guys... how can I create a library module (if im using the right term) in VC.NET or VB.NET ? A library module inwhich we define classes (and their functions) which then can be distributed to other developers for reuse. A link to such a topic is appreciated. thnx
|
|
|
|
|
Just create a new project and select static library or DLL as your project type. You could also read some of the MSDN help[^] on the subject; it even has links to CodeProject articles.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
|
int ColorNo[3];
ColorNo[0]=COLOR_BTNFACE;
ColorNo[1]=COLOR_WINDOW;
ColorNo[2]=COLOR_SCROLLBAR;
COLORREF Colors[3];
Colors[0]=RGB(25,50,0);
Colors[1]=RGB(255,255,0);
Colors[2]=RGB(255,255,0);
::SetSysColors(3,ColorNo,Colors);
I don't know why only COLOR_SCROLLBAR is useless. but else is validated.
I want to change the scrollbar color by modifying Windows XP theme, and I know someone make it successfully by this way.
|
|
|
|
|
|
1st of all, i am a newbie to Directshow programming..
i need to create a console program that detects audio from microphone..
in the code, i have a function which reads all the audio input device that i have.
and it returns the friendly name (as string) of the device that the microphone is plugged in.
below is the function code.:
string Get_FName(GUID DEVICECLSID)
{
HRESULT hr;
ICreateDevEnum *pDeviceEnum = NULL;
IEnumMoniker *pEnumCat = NULL;
wstring inname;
hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED );
hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER,IID_ICreateDevEnum, (void **)&pDeviceEnum);
if (FAILED(hr))
{
}
hr = pDeviceEnum->CreateClassEnumerator(DEVICECLSID, &pEnumCat, 0);
if (hr == S_OK)
{
IMoniker *pDeviceMonik = NULL;
ULONG cFetched;
while(pEnumCat->Next(1, &pDeviceMonik, &cFetched) == S_OK)
{
IPropertyBag *pPropBag;
hr = pDeviceMonik->BindToStorage(0, 0, IID_IPropertyBag,(void **)&pPropBag);
if (SUCCEEDED(hr))
{
VARIANT varName;
VariantInit(&varName);
hr = pPropBag->Read(L"FriendlyName", &varName, 0);
if (SUCCEEDED(hr))
{
inname = varName.bstrVal;
hr = pDeviceMonik->IsRunning(0,0,0);
if ( hr == S_OK){ goto skip;}
}
VariantClear(&varName);
pPropBag->Release();
}
pDeviceMonik->Release();
}
pEnumCat->Release();
}
skip:
pDeviceEnum->Release();
string s(inname.begin(), inname.end());
s.assign(inname.begin(), inname.end());
return s;
}
the problem is that, i have two input devices..
Microphone (Realtek...
Realtek (Audio ...
the program does not return the friendly name of the device which i plugged my microphone in. it simply returns the later device.
i need a code that detects wether the device is plugged in or not..thank in advance
|
|
|
|
|
Hello Friends
I want to add a Image as a object on image so that I can Pick and drag-Drop anywhere on Image in MFC.Or Is there any function in GDI?
Any Ideas?
Thanks & Regards
Yogesh
|
|
|
|
|
Basically what you have to do is to create a memory device context and then load a bitmap into this device context.
You can then draw any other shape or bitmap onto the memory device context which you can then save to disk.
Here is an example (VB code)-
http://www.vb-helper.com/howto_memory_bitmap_draw_type.html[^]
|
|
|
|
|
Thanks For ur Reply.
Regards
Yogesh
|
|
|
|
|
How do I obtain an HBITMAP handle to a bitmap image that I have previously loaded into a region of memory?
I want to keep the bimtap file encrypted on disk, and only decrypt it in memory.
|
|
|
|
|
|
Hello folks.
Do you know if there is anything like a GUID (Globally Unique IDentifier) for optical discs, CDs and DVDs and if yes, how would one go about retrieving this in VC++? Actually what i'd like to do is recognize the disc once it is loaded into an optical drive to e.g. have an autorun function that can be enabled/disabled per disk (program would respond on WM_DEVICECHANGE, query GUID, check against database and if enabled, autorun the disk, if not enabled, then do nothing, just an example).
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
|
|
|
|
|
Code-o-mat wrote:
Do you know if there is anything like a GUID (Globally Unique IDentifier) for optical discs, CDs and DVDs...
Check out:
HKLM\SYSTEM\ControlSet001\Control\Class\{4D36E965-E325-11CE-BFC1-08002BE10318}
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|