Click here to Skip to main content
15,896,726 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Plz, Help! win32 - edges on buttons Pin
Hamid_RT17-Apr-08 1:38
Hamid_RT17-Apr-08 1:38 
GeneralRe: Plz, Help! win32 - edges on buttons Pin
CPallini17-Apr-08 1:48
mveCPallini17-Apr-08 1:48 
GeneralRe: Plz, Help! win32 - edges on buttons Pin
Rajesh R Subramanian17-Apr-08 1:53
professionalRajesh R Subramanian17-Apr-08 1:53 
GeneralRe: Plz, Help! win32 - edges on buttons Pin
Hamid_RT17-Apr-08 2:00
Hamid_RT17-Apr-08 2:00 
GeneralRe: Plz, Help! win32 - edges on buttons Pin
Rajesh R Subramanian17-Apr-08 2:03
professionalRajesh R Subramanian17-Apr-08 2:03 
GeneralRe: Plz, Help! win32 - edges on buttons Pin
CPallini17-Apr-08 1:51
mveCPallini17-Apr-08 1:51 
JokeRe: Plz, Help! win32 - edges on buttons Pin
Hamid_RT17-Apr-08 2:00
Hamid_RT17-Apr-08 2:00 
JokeRe: Plz, Help! win32 - edges on buttons Pin
Rajesh R Subramanian17-Apr-08 2:01
professionalRajesh R Subramanian17-Apr-08 2:01 
GeneralRe: Plz, Help! win32 - edges on buttons Pin
CPallini17-Apr-08 2:06
mveCPallini17-Apr-08 2:06 
JokeRe: Plz, Help! win32 - edges on buttons Pin
Cedric Moonen17-Apr-08 2:08
Cedric Moonen17-Apr-08 2:08 
GeneralRe: Plz, Help! win32 - edges on buttons Pin
Hamid_RT17-Apr-08 1:36
Hamid_RT17-Apr-08 1:36 
GeneralRe: Plz, Help! win32 - edges on buttons Pin
Member 382549317-Apr-08 3:17
Member 382549317-Apr-08 3:17 
Generalcode analysis Pin
saqib8216-Apr-08 23:26
saqib8216-Apr-08 23:26 
GeneralRe: code analysis Pin
Cedric Moonen16-Apr-08 23:45
Cedric Moonen16-Apr-08 23:45 
GeneralDetect if pointer points to the stack or the heap Pin
piul16-Apr-08 21:55
piul16-Apr-08 21:55 
GeneralRe: Detect if pointer points to the stack or the heap [modified] Pin
Naveen16-Apr-08 23:13
Naveen16-Apr-08 23:13 
GeneralRe: Detect if pointer points to the stack or the heap Pin
Cedric Moonen16-Apr-08 23:25
Cedric Moonen16-Apr-08 23:25 
GeneralRe: Detect if pointer points to the stack or the heap Pin
piul16-Apr-08 23:36
piul16-Apr-08 23:36 
GeneralRe: Detect if pointer points to the stack or the heap Pin
CPallini16-Apr-08 23:53
mveCPallini16-Apr-08 23:53 
GeneralRe: Detect if pointer points to the stack or the heap Pin
Moak17-Apr-08 0:20
Moak17-Apr-08 0:20 
GeneralRe: Detect if pointer points to the stack or the heap Pin
James R. Twine17-Apr-08 8:05
James R. Twine17-Apr-08 8:05 
GeneralRe: Detect if pointer points to the stack or the heap Pin
Naveen17-Apr-08 14:03
Naveen17-Apr-08 14:03 
GeneralRe: Detect if pointer points to the stack or the heap Pin
Stephen Hewitt17-Apr-08 15:20
Stephen Hewitt17-Apr-08 15:20 
It's a strange question. But here's how it can be done:

// IsOnStack.cpp : Defines the entry point for the console application.
//
 
#include "stdafx.h"
#include <iostream>
#include <windows.h>
using namespace std;
 
bool IsOnStack(const void *pData)
{
	DWORD StackBase;
	DWORD StackLimit;
	__asm 
	{
		MOV EAX, DWORD PTR FS:[0x04]
		MOV StackBase, EAX
		MOV EAX, DWORD PTR FS:[0x08]
		MOV StackLimit, EAX
	}
 
	DWORD Address = reinterpret_cast<DWORD>(pData);
 
	return (Address >= StackLimit) && (Address < StackBase);
}
 
const char* PrintStack(const void *pData)
{
	return IsOnStack(pData) ? ": Stack" : ": Not on Stack";
}
 
int main(int argc, char* argv[])
{
	const char *pString1 = "String1";
	cout << pString1 << PrintStack(pString1) << endl;
 
	char String2[] = "String2";
	cout << String2 << PrintStack(String2) << endl;
 
	return 0;
}


Output is:
String1: Not on Stack
String2: Stack


Steve

GeneralGet ProjectName at compiletime Pin
hansipet16-Apr-08 20:43
hansipet16-Apr-08 20:43 
GeneralRe: Get ProjectName at compiletime Pin
Hamid_RT16-Apr-08 20:46
Hamid_RT16-Apr-08 20:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.