|
< laughing tears />
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
Hello,
i'm developing a chat program. There's a vector of pointers to Dialogs. When i open a chat window, a NEW is called to that dialog, then i call create and showwindow to show the dialog. The windows are deleted when i close the program.
I'm not having trouble with that.
When i close a window, i send a message to the remote client to close the window. The remote client receives this message in a function from the dialog, and there i want to close the dialog (not the remote one):
CVentanaPizarra::OnClose();
CDialog::EndDialog(0);
In the OnClose I have the following:
void CVentanaPizarra::OnClose()
{
CDialog::OnClose();
}
If i don't use EndDialog, the dialog doesn't close. If i use EndDialog, when i want to open the dialog again, the program crashes.
i don't want to delete the memory, just hide the dialog, or close it in some kind of way. i know it works locally, as when i close with the X, then i can open it again, but not when i receive the message.
I searched in msdn, and it says EndDialog is or modal dialogs. So i tried DestroyWindow. I also tried ShowWindow(SW_HIDE) but it doen't work as well.
I'd really appreciate any kind of help you could give me.
Thanks in advance!
|
|
|
|
|
If it is a modeless window - as I understand - then I should go for ShowWindow( SW_HIDE ) . The drawbacks are that you might need to reinitialize controls when showing it again.
Note that first, you create the window with Create . Then you use ShowWindow( SW_SHOW / SW_HIDE ) for all showing and hiding - you don't call Create again.
|
|
|
|
|
ShowWindow will work fine, but keep in mind, the more windows you create (and eventually hide again), the more memory your app will comsume.
A better way would be to destroy the windows if you don't need them again and call delete this; in the PostNcDestroy -function of your dialogs.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
hiya
i'm trying to import ~1000 records into a database per transaction (1 transaction per second). I'm thinking that use of a DataSet / DataAdaptor will be a good idea, i.e. create the local DataSet and then commit this to the database. But due to the size of the database, around 1gb, i don't want to do make a local copy of the database every time i want to do an insert (i'm not changing the existing data). Is it possible to make an empty DataSet of the target database table, fill this with inserts, then commit this to database WITHOUT deleting the existing data?
Thanks!
J
|
|
|
|
|
oh, using c++.net, ADO.net and SQLserver2k
j
|
|
|
|
|
Hi all:
I am writing a program where a list of wav files is presented to the user. The user may select one of these files and press a "play" button to hear the contents of their selected file. The problem is that I want to be able to automatically open that wav file in the machine's default application for wav files. For instance, if the user has set up their machine to use Windows Media Player as the default application for wav files, then when they click on my "play" button I would like to invoke WMP and automatically play the file. In fact, the behavior I want to implement is identical to the behavior seen when you double click on a file in Windows Explorer. The file will open inside the default application set for that type of file. Any help you can provide would be greatly appreciated.
Thanks!
|
|
|
|
|
ShellExecute()
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
First of all, thank you very much! ShellExecute() did exactly what I needed.
Secondly, I assume the snoring smiley was used to indicate that this was a stupid question and I don't feel that was needed. If my assumption is incorrect, I apologize.
|
|
|
|
|
>> indicate that this was a stupid question
Not at all! It gets asked here 2 to 3 times a week so it's boring is all. Actually this was much more intersting
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
I agree.
They deserve extra credit for trying to do the right thing
|
|
|
|
|
Hello
I am using 256 color icons for my toolbar, however each of the icons has a white (or light grey) background which is ugly. How is it possible to make the icons transparent on any windows theme?
Thanks in advance.
|
|
|
|
|
i did not try this out, but I would start this way:
subclass the bar
overwrite the WM_CTLCOLOR of the bar
and set in the method
{
pDC->SetBkMode( TRANSPARENT );
return m_LeerBrush;
}
where m_LeerBrush=GetStockObject(HOLLOW_BRUSH)
Then use a transparent color for the icon
hope this helps
|
|
|
|
|
Hello
This will not work.
The toolbar internally works with old primitive bitmaps. (it comes from the Windows 3.1 times)
SetBkMode(TRANSPARENT) is useless for painting bitmaps. It is mainly for printing text.
What you have to do is assign an Imagelist to the toolbar.
The imagelist can maintain a primitive transparency using a mask.
With i_ImageList.SetBkColor(..) you can define with which color the "transparent" pixels are filled.
With i_ImageList.Add(AfxGetApp()->LoadIcon(IDI_ICON1) you can load transparent icons.
With i_Toolbar->GetToolBarCtrl().SetImageList(&i_ImageList) you assign the image list
And as LAST you can load the toolbar tooltips and Command IDs trom the resources
i_Toolbar.LoadToolBar(IDR_TOOLBAR1);
The images stored in the resources will be overridden with your imagelist.
Please note:
This is NOT real transparency with an Alpha channel!
You can NOT draw XP icons or alpha channel bitmaps with various levels of transparency!
And you can NOT draw on a multicolored backgound.
Elmü
|
|
|
|
|
Any suggestions? Still no luck.
if (!myBar.CreateEx(this, TBSTYLE_FLAT | TBSTYLE_TRANSPARENT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC))
{
TRACE0("Failed to create toolbar\n");
return -1;
}
myBar.LoadToolBar(IDR_TOOLBAR1);
list1.Create(16, 16, ILC_COLOR32 | ILC_MASK, 2, 2);
list1.SetBkColor(RGB(255,0,0));
list1.Add(AfxGetApp()->LoadIcon(IDI_ICON1));
list1.Add(AfxGetApp()->LoadIcon(IDI_ICON2));
myBar.SendMessage(TB_SETIMAGELIST, 0 , LPARAM (list1.m_hImageList));
myBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&myBar);
|
|
|
|
|
Hi, Try the below code. It will work for sure.
if (!m_wndToolBarMaha.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC ) )
{
TRACE0("Failed to create toolbar\n");
return -1;
}
CWinApp* pApp= AfxGetApp();
m_TBarImages.Create(32, 32, ILC_COLOR, 4, 4);
m_TBarImages.SetBkColor( RGB( 192, 192, 192 ) );
m_TBarImages.Add(pApp->LoadIcon(IDI_ICON1));
m_TBarImages.Add(pApp->LoadIcon(IDI_ICON2));
m_TBarImages.Add(pApp->LoadIcon(IDI_ICON3));
m_wndToolBarMaha.GetToolBarCtrl().SetImageList(&m_TBarImages);
m_wndToolBarMaha.LoadToolBar(IDR_MAINFRAME);
m_wndToolBarMaha.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBarMaha);
Mahadev
|
|
|
|
|
At design time, I need to refresh the Property Browser when giving a property a specific value. Does anyone know how I can do this?
Thank you
|
|
|
|
|
Hi.
I want to write a customized ListBox control, (with UNICODE support and other stuff) for use in a Visual Basic 6.0 application.
I start App.Wizard and I select "MFC ActiveXControl Wizard" project.
Then I select 'ListBox' in step 2 where say "Which window class, if any, should this control subclass"?
But when all is finish and I am with the project created I find that I do not get any ListBox function like AddString(),
GetString(), SetItemData(), etc, etc.
I must write all those functions?
Where could I find some information about creating a new Activex Control based on Listbox.
Thank you.
|
|
|
|
|
The class generated by the wizard is derived from COleControl and by subclassing the window to LISTBOX, it is only subclassing the default LISTBOX. That way, I think you can use normal LB_XXXX messages to addstring, getstring, etc. For example, to add a string, the message to send is LB_ADDSTRING.
Jaime
|
|
|
|
|
Ok.
But the handle from what window should I use as first parameter?
I.E:
in a method inside the activex:
<br />
<br />
...<br />
<br />
::SendMessage(???, LB_ADDSTRING, 0, 0);<br />
<br />
...<br />
??? ->handle to the window will receive the message.
Thank you for your support.
Roger
|
|
|
|
|
The handle is the handle of the COleControl derived class, but, since you are in "this" control, take the :: off.... so the call would be:
SendMessage(LB_ADDSTRING, 0, (LPARAM) _T("Testing"));
Note that call has to be made after the control has been created... for example, after the call to COleControl::OnCreate call and on..
Jaime
|
|
|
|
|
Yes that works!.
But now I have a little problem and I dont know why. I want to handle the message OnDrawItem() and OnMeasureItem() and the program flow never pass through these functions. Do you know what is the problem?.
Thank you very much.
Roger.
PS: Sorry about my english.
Demian.
|
|
|
|
|
Yes that works!.
But now I have a little problem and I dont know why. I want to handle the message OnDrawItem() and OnMeasureItem() and the program flow never pass through these functions. Do you know what is the problem?.
Thank you very much.
Roger.
PS: Sorry about my english.
|
|
|
|
|
Have you modified the style to LBS_OWNERDRAWFIXED or LBS_OWNERDRAWVARIABLE before control creation?
You may also think about painting the control in WM_PAINT message.
Jaime
|
|
|
|
|
Hi Everybody,
We are looking for C++ Programmers in India. Its a contract work for one year. Programmers can work from home.
Please contact Sandeep Gandhi @ Sandeep@landmark4u.com
Thanks
|
|
|
|