|
|
Then you should found both the libraries (comsuppw.lib & comsuppwd.lib ) inside <your VS installation path>\VC\lib , I suppose.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[Image resize DLL]
|
|
|
|
|
Hi ,
http://www.codeproject.com/KB/printing/QPrint.aspx[^]
There is any option in table for set table column width according to text.
Because now here if the data is larger than the column than it not print all data.
I want column width is automatically incresed when data is large.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
You have already asked this question at the discussion forum of the article page. Can you please wait until the author responds? You could have asked it here if the author didn't respond in a day or two.
You had to post it here in another two minutes after asking there? You see, cross-posting is just plain rude (even if it is urgentz).
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
Ok sir.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
This code is taken from "http://www.codeproject.com/KB/list/lvcustomdraw.aspx" an MFC project. i made changes in the code to suitable for a Win32 project. But this code is not working.
i am able to get CDDS_PREPAINT but not ITEMPREPAINT or (CDDS_ITEMPREPAINT | CDDS_SUBITEM).
if( ((NMHDR*)lParam)->code == NM_CUSTOMDRAW )
{
pLVCD = reinterpret_cast<nmlvcustomdraw*>( lParam );
if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
{
return CDRF_NOTIFYITEMDRAW;
}
else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
{
return CDRF_NOTIFYSUBITEMDRAW;
}
else if ( (CDDS_ITEMPREPAINT | CDDS_SUBITEM) == pLVCD->nmcd.dwDrawStage )
{
COLORREF crText, crBkgnd;
if ( 0 == pLVCD->iSubItem )
{
crText = RGB(255,0,0);
crBkgnd = RGB(128,128,255);
}
else if ( 1 == pLVCD->iSubItem )
{
crText = RGB(0,255,0);
crBkgnd = RGB(255,0,0);
}
else
{
crText = RGB(128,128,255);
crBkgnd = RGB(0,0,0);
}
pLVCD->clrText = crText;
pLVCD->clrTextBk = crBkgnd;
return CDRF_DODEFAULT;
}
}
Thanks & Regards
|
|
|
|
|
Hi all,
This may seem very elementary, but why "&a + 1" and "a + 1" are different in the following code
int a[5] = {1, 2, 3, 4, 5};
int* ptr = (int*)(&a + 1);
printf("%d, %d", *(a + 1), *(ptr-1));
Thanks,
|
|
|
|
|
*(a + 1) returns a pointer to the 2nd element in a, which here is 2; a + 2 would return the 3rd element in a, which is 3, and so on.
(&a + 1) returns &a , which is a pointer of a , and as pointer arithmetic is used here, +1 increments this address by 20, as a has a size of 20 (5 ints or 5 * 4 bytes), which would point to the next memory block AFTER a . When you print (ptr-1) this decreases the pointer address by 4 (4 bytes to an int), which returns the 5th element in the array, which is 5.
Hope this helps,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
Introduction to Object-Oriented JavaScript
|
|
|
|
|
I still don't understand. To me "a" is of type a[5] and "&a" is of type pointer, so they're supposed to calculated in 20 and 4 bytes unit respectively, but that's contrary to the actual result.
|
|
|
|
|
I understand your doubts. Arrays on stack and dynamically allocated arrays have differences, but we must have a uniform way to access elements with pointers. From this point of view 'a' must be an int*. On the other hand 'a' must be like any other stack object (struct or class). We must be able to take the actuall size with the sizeof operator or access the elements by casting the base address '&a'. For reasons like the above we see 'strange' things like &a == a
|
|
|
|
|
a is an array of 5 ints.
so a is the address of the 1st element of the array, and is of type int* (if we consider an int to be 4 bytes, incrementing a will move the pointer 4 bytes further).
&a however is the address of the variable a itself, and is of type int[5] (if we consider an int to be 4 bytes, int[5] weights 20 bytes, so incrementing &a will move the pointer 20 bytes further).
as suggested by CPallini, have you tried to print some sizeof to check that ?
|
|
|
|
|
So, what was the question?
BTW try also
printf("%d, %d\n", sizeof(a), sizeof(int*));
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[Image resize DLL]
|
|
|
|
|
I am using thread, when I debug, It is crashing after completion of thread
---------------------------
navigator.exe - Application Error
---------------------------
The instruction at "0x5f43690b" referenced memory at "0x02470014". The memory could not be "read".
Click on OK to terminate the program
Click on CANCEL to debug the program
---------------------------
OK Cancel
---------------------------
|
|
|
|
|
How do you expect any help with the details you've given? Provide more information such as:
- Source around the crash.
- Values of the variables of interest.
- Stack trace to crash.
- Machine code around crash and register values.
- ...Basically anything...
Steve
|
|
|
|
|
This is access to already delete memory block. One common case is deleting a memory block or object two times or dealing with a in another thread.
Tip: check if the address is constant or changing and look what is in it.
Greetings from Germany
|
|
|
|
|
KarstenK wrote: This is access to already delete memory block
That is only ***ONE*** possible cause.
Steve
|
|
|
|
|
Dear All,
My project requirement is VC++ application need to display the color of individual cells using CListCtrl.How to implement this.
It will be much helpful to me to give some advice on this..
Thank you very much,
Yours,
Anitha
|
|
|
|
|
|
|
thUpdateUI= AfxBeginThread (StartUpdateUIThread, _param);
WaitForSingleObject(thUpdateUi,INFINITE);
but dosn't wait for the thread to complete
modified on Tuesday, August 19, 2008 2:37 AM
|
|
|
|
|
IF you just want to block the current thread till the other thread completes why use threads??
You can just call the function
UINT iRet = StartUpdateUIThread(_param);
I hope it helps..
I think you did not like my opinion
Regards,
Sandip.
modified on Tuesday, August 19, 2008 2:53 AM
|
|
|
|
|
The call bock the whole main thread, so
|
|
|
|
|
ptr_Electron wrote: The call bock the whole main thread, so
Quote Selected Text
What does it mean? Even WaitForSingleObject will block the current executing thread(Main Thread).
BTW MSDN Says
The WaitForSingleObject function checks the current state of the specified object. If the object's state is nonsignaled, the calling thread enters the wait state until the object is signaled or the time-out interval elapses.
I think you did not like my opinion
Regards,
Sandip.
modified on Tuesday, August 19, 2008 2:54 AM
|
|
|
|
|
Try something like this:
CWinThread *pThread = AfxBeginThread(&StartUpdateUIThread, _param, THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED);
ASSERT(pThread);
HANDLE hThread;
VERIFY(DuplicateHandle(GetCurrentProcess(), *pThread, GetCurrentProcess(), &hThread, 0, FALSE, DUPLICATE_SAME_ACCESS));
pThread->ResumeThread();
WaitForSingleObject(hThread, INFINITE);
CloseHandle(hThread);
It's probably a good idea to wrap all this mess in a helper function.
Steve
|
|
|
|
|
::AfxBeginThread() does not return a handle that can be used for waiting. It returns a pointer to a CWinThread object.
ptr_Electron wrote: but dosn't wait for the thread to complete
If you would have bothered to check the return value from ::WaitForSingleObject() you would have found that the operation failed. A call to ::GetLastError() would most likely return ERROR_INVALID_HANDLE . To omit the validation of the return value is just sloppy.
A few days ago you had almost the same question regarding the same problem, which I replied to here[^].
I suggested an article that would explain all this and teach you how to do it the right way. If you would have bothered to read the article, this question would not have been necessary. I can see that you now use ::AfxBeginThread() instead of ::_beginthreadex() , but that's not enough.
Read the article here[^].
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|