|
Hi Cedric,Jonathan and D.Mani
Thanks a lot for your quick replies.
I got my problem completely solved now.
With Regards
Neeraj Sinha
|
|
|
|
|
|
My project has a dialog, in this dialog, have two control: A and B
when this dialog print, A covered B, but when B has some change(change color, for example), and then B covered A.
How to lead A covered B again? Thanks!
|
|
|
|
|
Look up SetWindowPos(),you should be able to use this to change your controls Z-order.
|
|
|
|
|
if that's normal for your design that they overlap, then you should hide the control overlapped by calling ShowWindow(FALSE) on it.
otherwise, you have a design issue in your dialog :p
|
|
|
|
|
I set a Dialog's "Vertical scroll" property true.Now I want to calculate its scroll bar's width. how to do it ?
Thanks in advance.
|
|
|
|
|
Peter, Chan wrote: I set a Dialog's "Vertical scroll" property true.Now I want to calculate its scroll bar's width. how to do it ?
::GetSystemMetrics( SM_CXVSCROLL );
|
|
|
|
|
|
|
Hi all,
I was wodering if it is possible to pass values to a thread function without calling _beginthread() for a second time. For example, a thread is created and the thread performs it's tasks, now the thread must perform the same task but this other data, and one doesn't want to create a new thread again. Is this possible ???
Many Thanks
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
Yes: there are several ways to do that. In general, what I do is a thread that simply calls a member function of a class to do some processing. The class is passed as an argument to the thread function.
So, as the function is a member of the class, you have access to all the members of the class and you can modify them. Of course, you need to secure this with synchronization objects (critical sections, mutexes, ...) to avoid that a same 'member' is accessed at the same time by two different threads.
I hope it makes sense.
|
|
|
|
|
Thanks Cedric, yes it makes sense, kinda. If I may be so bold as to ask for an example if it is possible.
Many Thanks
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
Programm3r wrote: If I may be so bold as to ask for an example if it is possible.
Something like this:
class CThread
{
public:
CThread();
virtual ~CThread();
void StartThread();
void ThreadFunc();
HANDLE m_hThread;
};
DWORD WINAPI ThreadProc(LPVOID lpParam)
{
CThread* pThread = (CThread*)lpParam;
if (pThread)
pThread->ThreadFunc();
return 0;
}
CThread::CThread()
{
}
CThread::~CThread()
{
}
void CThread::StartThread()
{
m_hThread = CreateThread(NULL,0,ThreadProc,this,0,NULL);
}
void CThread::ThreadFunc()
{
}
|
|
|
|
|
|
Hi,
I have a web based application in which we have 8 ocx for displaying images.
Currently images are loaded from CD .But now we want to allocate some memory in some of the 8 ocx we have and in this memory we will save maximum files that we could.
Then we want to access this memory buffer using cmemfile.
So we need to create a common memory which can be accessed by all the ocx on the page.
I dont know how to create such memory? And then how to access the memory through different ocx.
Please provide me some inputs on this..
Surendra Vishwkarma
|
|
|
|
|
You might want to look up the CoTaskMemAlloc function and also Memory Mapped Files. Your biggest problem is likely to be browser security. It will not like your embedded controls accessing memory outside their normal scope. You might even have to consider replacing the OCX with Javascript but hopefully not .
It should be possible to write script on the page which can access the controls and negotiate between them which one will own/create a memory mapped file and then communicate it's handle to the other controls.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Hi,
I have a Win32 Console Application which is throwing the Debug Assertion Failed! .. _CrtIsValidHeapPointer( pUserData ) and followed by a Debug Assertion Failed! .. _BLOCK_TYPE_IS_VALID(pHead->nBlockUse).
After I did a Step by Step Debug strangely what I saw was it is throwing error once it is exittin the main function.
Unlike any character pointers and deletion of heap without its references as of when generally this error occurs I have no such instances.
please could you suggest a probable solution to this. please help.
There are only two kinds of people who are really fascinating-people who know absolutely everything, and people who know absolutely nothing.
Oscar Wilde (1854-1900)
Regards...
Shouvik
|
|
|
|
|
Looks like you are trying to delete the same pointer twice, or trying to delete something which is not a pointer to a heap based object.
If you can post some of the code, then we can help.
|
|
|
|
|
The normal debug configuration of a VS C++ project checks the heap hasn't been corrupted when you exit. If these assertions fire, the heap has been corrupted.
This is a wild-write bug. Somewhere, you're using a bad pointer, or have made a mistake in pointer calculation, or allocated too little space for a buffer, or written off the end of a buffer. These are very hard to track down. Ensure that you always initialize pointers to NULL or to a real value, so you don't get random stack garbage that could point anywhere.
If it's consistently the same address, you can use a data breakpoint to see when the data at that address changes. See 'data breakpoints' in MSDN Library.
|
|
|
|
|
|
according to the following call stack
<br />
NTDLL! 7c901230() <br />
NTDLL! 7c96cd80() <br />
NTDLL! 7c960af8() <br />
KERNEL32! 7c85e9cf() <br />
_CrtIsValidHeapPointer(const void * 0x00032b78) line 1697<br />
_free_dbg_lk(void * 0x00032b78, int 1) line 1044 + 9 bytes <br />
_free_dbg(void * 0x00032b78, int 1) line 1001 + 13 bytes operator <br />
delete(void * 0x00032b78) line 351 + 12 bytes <br />
CString::FreeData() line 146 + 15 bytes <br />
CString::~CString() line 213 $E155() + 34 bytes <br />
doexit(int 0, int 0, int 0) line 353 <br />
exit(int 0) line 279 + 13 bytes <br />
mainCRTStartup() line 345 <br />
KERNEL32! 7c816fd7()<br />
It is clear the error was occuring tryin to free the CString objects which incidentally I had made global due to the requirements. Hence I refactored my application and passed them as reference.
What I inferred from the situation is that while tryin to free up the Cstring memory it encountered that the heap had already been unintiallized. however it is still unclear to me how was the heap cleared before even C Runtime tried to unregister it. I never explicitly have defined any destructors.
There are only two kinds of people who are really fascinating-people who know absolutely everything, and people who know absolutely nothing.
Oscar Wilde (1854-1900)
Regards...
Shouvik
|
|
|
|
|
HELLO to every one..
my question is if i click a menu item from IDR_MAINFRAME window MENU BAR ,i have to be switched to IDR_MENU1 window..
plz help me..
vikram..
|
|
|
|
|
You could create a handler for that menu item, and inside it, call SetMenu ?
Sounds like a potentially bad design though, so I hope you have a really good reason for doing it this way.
Iain.
|
|
|
|
|
I was thinking about your question but I dont know your questions is advance or I dont understand your question.
|
|
|
|
|
To load a plugin from an application - the ATL/COM connection points are used for communication and handling events between host and plugin. If i were to add a second plugin which would load all dlls from a different path and replicating the mechanism of the first plugin, do i need to do any handling for memory management or threading issues? The two plugins will not communicate to one another, and user would switch between the plugins as necessary but the dlls for both plugins will be loaded at the start of the application and unloaded only when application is shutdown.Am not clear if i should inbuild any mechanism for threading or memory ownership issues? Could you also point me to a reference article if any?
Thanks
|
|
|
|