|
All looks fine to me, except I'm not sure why hOld is not a HBITMAP ? That may be the problem, but I don't see why.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
Can someone help my with the item addition issue then? Maybe I could find something there
|
|
|
|
|
You almost/kinda have it. I'm not sure what exactly m_Thumb->CreateFromHBITMAP( hBitmap ); does.
The theory is once you have a HBITMAP from your thumbnail you either use the CImageList Replace method if you're using MFC, or ImageList_Replace using straight win32. It looks like your 3rd party lib will give you a HBITMAP when you need it. Just use that to replace the 0th image in the imagelist.
If you need further help, let me know. What I do is slightly different. I store the raw image data using a FAST data (un)compression library and decompress it on-the-fly. Image lists tend to consume large amounts of memory when used exclusively. Once I figured out this method my app consumes about 1/10th the memory it used to.
Joel Lucsy (jjlucsy@ameritech.net)
|
|
|
|
|
Well, it seems like I'm unable to make the listview handle my handles properly or what... I still cannot figure it out. Could you contact me via e-mail? I need to discuss some related issues. My ICQ is 100419594 - thanks much for your help
|
|
|
|
|
I was told that I could debug with the OnSysCommmand handler. I cant find in the Clas wizard where it is to add it. Will it be a handler in the mainframe? Or the view? Anyways I dont see a SySCOMMAND message or anything likethatin theCW for mainframe class or view class...
Thanks,
ns
(I want to debug a crash that happens when I click the right cross system menu)
|
|
|
|
|
Add Windows Message Handler dialog has combo box "Filter for messages available to class". Select "window" in this combo, and you will see all messages, including WM_SYSCOMMAND.
|
|
|
|
|
I want to debug the crash when I close with the right hand x (WM_SYSCOMMAND). Which class should I put the handler in? The mainframe? Or the view? Or the doc?
Thank you
ns
|
|
|
|
|
|
Now that I've found the WM_SYSCOMMAND message, how exactly do I debug the crash? The handler is going to be empty, so what shall I put a breakpoint on?
void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam)
{
CMDIFrameWnd::OnSysCommand(nID, lParam);
}
How does having an almost empty handler help you figure out why you are crashing when exiting wit the system right cross?
I must be missing something obvious!! Help!
Thanks,
ns
|
|
|
|
|
ns wrote:
How does having an almost empty handler help you figure out why you are crashing when exiting wit the system right cross?
It may not help. If your application crashes on exit, you probably have a big memory leak or something. Run the exe from the debugger and look at your ouput window in MsDev after you exit the application. See if it is reporting any memory leaks and so on..
Bijesh
------------------------------------------
|
|
|
|
|
Since this crash was happening after several times of rerunning a particular function, I looked at it, found a new char being created, and never deleted. It was a pretty big char array. SO I did a delete and set the pointer = NULL. Are these two steps the right thing to do? In my main app, I have lots of 'new' variables but they are all small and in 90% of the places I dont delete them . But since this turns out to be a cumulative problem, I am going to weed them out and delete them, and NULL them. Is the NULL a good practice or unnecessary?
Thanks,
ns
|
|
|
|
|
ns wrote:
But since this turns out to be a cumulative problem, I am going to weed them out and delete them, and NULL them. Is the NULL a good practice or unnecessary?
Thanks,
Its a good idea to NULL the pointer as soon as you delete it. You can combine that practice with checking for NULL before you use a pointer .
But.. it is very important to delete any memory(objects, variables etc) that you allocate with new. Smaller variables may not cause a problem initially, but they do accumulate like you said. Also if the application is used for long periods of time, the smaller memory allocations accumulate and cause a problem. So always 'delete' what you 'new'
Bijesh
--------------------------------------------------
|
|
|
|
|
I've got several member variables that are pointers and get used all the time. I am new at this stuff (no pun) so I am afraid to delete these since I access them all the time - for example some of these are doc variables that I access from several places at several times. I am deathly afraid I'll mangle my app if I delete these in the wrong place. Other than these, I've cleaned up my code.
Thanks,
ns
|
|
|
|
|
Hi all,
Whenever I insert a new dialog resource into my project, the dialog's font is System 8, which makes the dialog look odd when it's displayed. I'd like it to default to MS Sans Serif 8, which is what it used to be(I think). How can I change the default font for dialog resources? I'm using EVC.
Thanks!
Wes
Sonork ID 100.14017 wtheronjones
|
|
|
|
|
Open the .rc file up in a text editor (notepad works),
look for the text for the dialog you want to change that looks similar to this:
IDD_ABOUTBOX DIALOGEX 0, 0, 140, 57
STYLE WS_POPUP | WS_CAPTION
EXSTYLE WS_EX_CAPTIONOKBTN
CAPTION "About MyDialog"
FONT 8, "System"
and change the last line to be FONT 8, "MS Sans Serif"
I've never done this myself, but it should work.
|
|
|
|
|
thanks for the post. that'll work for a single dlg. I can also get the same effect w/ the property dialog...on the General tab there's a btn to change the font. I'm kinda hoping to figure out the way to set the default font used for dialogs each time one is inserted.
thanks!
Wes
Sonork ID 100.14017 wtheronjones
|
|
|
|
|
I want a program where there is a a list on the left part of the window and a edit control on the right. I can get the edit control, but not the list control. I tried having my program starting with the explorer view, set when I made a new program, and changing all the CTreeView to CListView. That gave me all the CListCtrl functions but I can't get the colums of the lists with the titles to appear. How can I get them to show? Should I be taking a different approach?
-Raffi
|
|
|
|
|
- Make sure the list is in report view mode
- Make sure you've added columns *before* trying to add items
- Make sure you've added items
- Make sure the columns have greater than 0 width
---
Shog9
If I could sleep forever, I could forget about everything...
|
|
|
|
|
Thanks for the tips. Works great now.
-Raffi
|
|
|
|
|
I want my Open dialog to have a title saying "Open Photograph"
What can I set in
CFileDialog pDialog(TRUE,"*.bmp", "*.bmp", OFN_HIDEREADONLY ,"Image Files(*.bmp;*.dib;*.gif;*.jpg;*.jpe;*.ico;*.cur)");
to do this?
Or is there some other property that can be set to do this?
Thanks,
ns
|
|
|
|
|
Do this:
pDialog.m_ofn.lpstrTitle = "Open Photograph"; before you display the dialog.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi, I am creating a file server aplication, which has a Worker Thread for Uploading a requested file by a client...
My Thread just works fine, it does what it was suposed to do...
The problem is that I want it to Close the socket after sending the file....
It seems that I get a runtime error whenever I call CAsyncSocket::Close in the Thread,
Outside the Thread I got no problem...
How can I close the socket inside the Worker Thread?
The code is something like that :
UINT UpLoad(LPVOID p) //worker thread
{
CMyDialog *d = (CMyDialog *) p;
//do the stuff for uploading the file...
//close the socket...
p->MySocket.Close();
return 0;
}
Then on a member function of CMyDialog class I call :
AfxBeginThread(UpLoad, this);
MySocket is a public member variable of the CMyDialog class and is an object from a derived class of CAsyncSocket which I created.
Thanks.
|
|
|
|
|
I haven't used any of the CSocket stuff for a long time, but my recollection is that CSocket objects are like CWnd objects in that you have to be really careful when you try to pass them from one thread to another.
I'd suggest that rather than passing the CAsyncSocket object from the main thread to the worker thread, you should "Detach" the socket from the CAsyncObject in the main thread, pass it by handle to the worker thread and then "Attach" it to a new CAsyncSocket object in the worker thread.
|
|
|
|
|
I have a variable (its a char*) which has the following stuff in it:
char * xyz = "C:\dir1\dir2\file.mdb, location1"
I want to put this into two variables which look like
char * dbName = "C:\\dir1\\dir2\\file.mdb"
and
char* location = "location1"
Should I first convert xyz into a CString, then do stuff to it (what exactly? to get two subCStrings then convert them back into char *s?
So I'm looking at Find, Right and Left:
If I had CString str = "abcd,efg"
Then int pos = str.Find(",") should give me zero based location 4.
then
CString leftstr = str.Left(pos) will be "abcd"
and
CString rightstr = str.Right(str.GetLength() - pos-1) will be "efg"
I cant test this out right now, so I'm wondering if this will work. Do you see any flaws with my numbers or thought process? and to do the '\' to '\\' I'd use Replace....
Thanks,
ns
|
|
|
|
|
Try my CTokenizer[^] class. It might help you.
All of my opinions are correct, even when reality makes the mistake of disagreeing with me.
ASP.NET can never fail as working with it is like fitting bras to supermodels - it's one pleasure after the next - David Wulff
|
|
|
|