|
You need to create a bitmap of appropriate size to draw onto. The code below may help
CDC* pDC = GetDC();
ASSERT(pDC != NULL);
CRect rc(0, 0, 100, 100);
CDC memDC;
memDC.CreateCompatibleDC(pDC);
CBitmap bitmap;
bitmap.CreateCompatibleBitmap(pDC, rc.Width(), rc.Height());
CBitmap* pOldBmp = memDC.SelectObject(&bitmap);
...Draw some pixels
memDC.SelectObject(pOldBmp);
ReleaseDC(pDC);
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
Hi there!
My project looks like this:
#1 - libiupwin.lib - library written completely in C
#2 - app.exe - application written in C++ - depends on libiupwin.lib
The problem:
I can compile #1, and a .lib file is generated
I can compile #2, but linker fails with plenty of messages like:
Unresolved external '_iupDlgNext' referenced from (...)\libiupwin.lib|itraverse
"itraverse" is one of C files included in library, and iupDlgNext is of course a function (placed in library, too). I found one instance of 'iupDlgNext' and one instance of '_iupDlgNext' in a .lib file (using a text search).
I guess this has something to do with differences between C and C++ function calls, but since I have little experience with "linking problems" I could use some help with this one.
Thanks in advance.
[ CoY0te ]
Coyotus incrediblus...
|
|
|
|
|
If you have a header file for this library, you might need to add some lines like this at the top:
#ifdef _cplusplus
extern "C" {
#endif
and lines like this at the bottom
#ifdef _cplusplus
}
#endif
rebuild your C++ components, then see if it links okay.
|
|
|
|
|
The usual problem is that C linking is not specifed in the C header files. Therefor, the linker mangles the name found in the header file.
#ifdef __cplusplus
extern "C" {
#endif
/* C-Funcion prototypes */
#ifdef __cplusplus
}
#endif
The error message you show does not seem to imply that this is the problem, but it is well worth checking out.
Note: A function name mangled with an underscore in the error message is just the internal name of the function generated by the compilier (you may ignore the underscore). If you had named you function _Func the the error message would have called it __Func. Remember leading underscores are supposed to be reserved for vender/specific global variable/function names.
Well I do not know it this helped.
Good Luck!
INTP
|
|
|
|
|
I've managed to solve my problem yesterday.
I can't really tell what it really was, but it seem to me like a page size problem. Library had a page size increased to 64 since it was too large. I have created three libraries out of this one and left efault page size (16). Now it links juzt fine. Since I created new project, I'm not quite sure if something else didn't get involved, but perhaps it really was the page size.
So in cae anybody runs into similar problem this may be the hint.
Thanks for help.
[ CoY0te ]
Coyotus incrediblus...
|
|
|
|
|
i am a beginer to socket programming, i read your article i think it the best for beginers like me, i have two questions;
1. my question is how can i assign a specific ip address to server and client for example 193.125.100.10 and 193.125.100.11 for server and client respectively.
2. 2nd question is i want the application to act as server and client simultaneously, and can chat with multiple peers simultaneously.
i will be greatful for your help, and i am sure you will help beginner like me.
thanks and bye.
ShehrYar.
|
|
|
|
|
hi,
following problem:
i trace the actual front window with GetForegroundWindow(), then look up, if its classname is "CabinetWClass" or "ExploreWClass", witch are the explorer window-classes. ok, so far, so good.
then i subclass the "SysListView32" if it exists by passing through the CWnd-childwindows with
EnumChildWindows(..., ...) - fine, works!
i subclass the resulting CListView of the explorer-window and subclass its CListCtrl - ok - i can get the index of the selected item with .GetSelectonMark(). all functions work like .GetSelectionCount() and so on...
but the function .GetItemText(item, subitem) dosen´t work - also the .GetItem(&pItem) dosent return the filename of the selected file... so what??? anyone have an idea?
what i try to do:
i want to check out if specific files are selected in the windows-explorer-windows - if they are selected, i want to run a action...
cheers,
vertex_x
|
|
|
|
|
vertex_x wrote:
what i try to do:
i want to check out if specific files are selected in the windows-explorer-windows - if they are selected, i want to run a action...
Why not just add your action item to the context menu that pops up when you right-click a file? It's much easier, and wouldn't be nearly as annoying, than what you are currently doing.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
of course, thats right. but excessive right-clicking and popping windows takes to much time for me. i just want to cycle through a lot of files and directly see some type of preview... without draging files to a preview window or starting applikations via right-click...
|
|
|
|
|
Fair enough. Have you checked out the IShellChangeNotify interface? There's also SHChangeNotifyRegister() .
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
thanx alot!
i actually can´t find any documentation about them, even not in my msdn-library ;o) looking now on msdn in the net for it ;o)
i´ll notice here, if it works...
cheers,
vertex
|
|
|
|
|
with the above functions i get only messages if something is changed - eg. file rw-access, folder creation/delet, media insertion/remov and so on... but thanks anyway ;o) it was a good tray )
cheers,
vertex
|
|
|
|
|
Hey Guys
I have memory leak problem in my app.
I found one function in MSDN which gives the dump of memory if you have leak in u'r programm.
The functions is, _CrtDumpMemoryLeaks()
But it gives the output on console. I want to dump all information in one text file. Any pointer how to do that. ?
I use have also used following to print it in file
_CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE )
_CrtSetReportFile( _CRT_WARN, handle);
Where handle is _HFILE type of handle of opened file. But still it doesn't gives result as expected. My new created text file is empty...
Any help plz ?
Regards
Mike
|
|
|
|
|
is _DEBUG defined?
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
The following call redirects standard output to a file:
freopen( "log.txt", "w", stdout );
Hope it helps.
[ CoY0te ]
coyotus incrediblus...
|
|
|
|
|
Hello,
I am using two threads. One is called in the other one. Now I want to access some member variables of the main dialog in the second thread! How can I acchieve that?
I am using AfxBeginThread to create a thread. Is there anything else you need to know?
DKT
|
|
|
|
|
You need to obtain the pointer to the dialog class to access public member variables.
You can declare some functions like this:
<code>
static CMyDialog* s_MyDialogPointer = NULL
CMyDialog* GetMYDialogPointer()
{
return s_MyDialogPointer;
}</code>
Within the dialog's constructor, set the
<code>s_MyDialogPointer = this;</code>
In the second thread, call GetMYDialogPointer() to obtain pointer to the dialog class instance to change member data.
|
|
|
|
|
Frens. . .
I have two doubts.
1)How to give tooltips for Combo boxes.
2)How to enable multiple selection by pressing Ctrl Key in Flex grid .
Thanx
|
|
|
|
|
Hi
I have developed one simple DLL in VC++ as Project->New->Win32 Dynamic Link Library->An empty DLL project......
Now there is some Memory Leak in my DLL. But I don't know how to trace it and which functions or line is making memory leak.
Is there any freely availabe software or programm which I can use to check memory leak of my DLL ? All the programm to find Memory Leak I found is for EXE only....HOw to do it for DLL ?
Or
Any system functions which can tell something about memory leak...?
Pls help me out
It's hurry....
Regards
Mahesh
|
|
|
|
|
You can download Rational Purify evaluation copy from IBM.
Good luck.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
Can i have a combobox which is populated by country names.
Learner always
|
|
|
|
|
Yes.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
( i know I should'nt laugh !!! but the answer was a bit unexpected !!! )
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Maximilien wrote:
but the answer was a bit unexpected
I suppose you were expecting me to provide an example of populating a combobox with the names of the 193 countries. I like typing but not that much!
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I was asking is there any active x or any utility which can populate combo automatically.If only to type is solution than I can type my own .
Thx
Learner always
|
|
|
|