|
After CDialog::Create , call ShowWindow(SW_SHOW) .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks,
this is exactly what I do.
The problem is that modeless dialog stays always over its parent dialog, even when it is not focused. How to prevent this behaviour.
Thanks again
Stefan
|
|
|
|
|
To the best of my knowledge, you can't. This is standard behavior.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Maybe you can get the effect you want by making the desktop (GetDesktopWindow ) the parent of your modeless dialog.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
They are called modeless dialogs.
You can read this article :-
http://www.codeproject.com/useritems/gettingmodeless.asp
Nish
I am the Keyboard Smasher
|
|
|
|
|
Nish: I don't know HOW many times I've seen you change your signature!
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
How can I make use of CRebar and CToolBar in a dialog-based window? (I dont want to use CRebarCtrl/CToolBarCtrl)
ps: does MS intend to support MFC any further or is it going the way of the dodo?
|
|
|
|
|
Check MFC sample called DLGCBR32.
UGenn wrote:
does MS intend to support MFC any further or is it going the way of the dodo?
New version of MFC is included in VS.NET.
Tomasz Sowinski -- http://www.shooltz.com ** If you're going to rape, pillage and burn, be sure to do things in that order. **
|
|
|
|
|
My app creates html fire reports when it surprisingly enough detects a fire. I need the enum all the printers and print this html fire report inside a CWebBrowser2 controls on all the connected printers. I do this by setting the default printer, and printing, and then setting the default printer again etc.
I use the SetDefaultPrinter command. This worksd fine. The problem is though that it only works in Win2000+. MSDN says that I should use the following code on < Win2000
GetProfileString(TEXT("Windows"),TEXT("Device"),_T(",,,"),m_szName, COUNTOF(m_szName));
WriteProfileString(TEXT("Windows"),TEXT("Device"),pszPrinterName ));
#if WM_WININICHANGE != WM_SETTINGCHANGE
SendNotifyMessage(HWND_BROADCAST,WM_WININICHANGE,0,(LPARAM)szWindows);
#endif
SendNotifyMessage(HWND_BROADCAST,WM_SETTINGCHANGE,0,(LPARAM)szWindows);
I can't seem to get this to work I'm not quite sure what I should set szWindows to....
Can anyone help please? Thanks
Jeremy Davis
http://www.astad.org
|
|
|
|
|
Hello,
Can any one point me to a real time programming tutorial with vc?
tnx
|
|
|
|
|
Windows OSs are not real-time by nature, so your question seems a little unclear to me. Could you please ellaborate some more?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi,
Can anyone please give me any comment or solution to this situation??
In my program, I've used multithread (many clients) to send message to one thread(Server). However, I realized that only the first client can get access to the server from start to end, other clients are always blocked. Can anyone help me to solve this problem, so that all clients can access the server??
The following is the code of the server:
if ( svrSocket.Accept(socket))
AfxMessageBox("Socket is created Succesfully");
while (...)
flag = socket.Receive(buff,sizeof(buff));
....
Please HELP! Thank you!!
|
|
|
|
|
If you have the server thread processing the requests for one client in a tight loop, it can't accept other connections.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
hkl wrote:
flag = socket.Receive(buff,sizeof(buff));
Execution in this thread blocks until Receive can get (sizeof(buff)) bytes of data. You should probably use CAsyncSocket; it would probably meet your requirements better.
Jon
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
That is because the thread Accept() ing the connection is the same that Receive() s the request on the socket.
You must dispatch the socket returned by Accept() first param to another thread, which will Receive() , preventing the server thread from blocking.
If you have problem understanding this concept, I suggest that you read this:
http://www.codeproject.com/useritems/winsockintro03.asp
Michel
If I am wrong or said something stupid, I apologize in advance
|
|
|
|
|
that's all,
i want to know if it possible pass a array of doubles like parameter by reference to a function and in the case it was possible how.
Thanks in advance.
|
|
|
|
|
You just want to change the array elements in the function?
Tomasz Sowinski -- http://www.shooltz.com ** If you're going to rape, pillage and burn, be sure to do things in that order. **
|
|
|
|
|
Yes i want, if it's possible i want pass an array where after an operations the result was back in this array.
|
|
|
|
|
Hi,
I need to pass an IPicture through process boundaries, but IPicture cannot be marshaled so I decide to pass it over one Stream created on one HGlobal..., what I did in the server is:
STDMETHOD(SetMetafile)(VARIANT GlobMeta)
{
HGLOBAL hGlob = (HGLOBAL) GlobMeta.lVal;
IStream *pStream = NULL;
HRESULT hr = ::CreateStreamOnHGlobal(hGlob, TRUE, &pStream);
if(!pStream) return S_FALSE;
if(!SetMeta(pStream, &_Pict)) {
return S_FALSE;
}
pStream->Release();
return S_OK;
}
BOOL SetMeta(IStream *pStream, IPicture **Pict)
{
BOOL bResult = FALSE;
CComPtr<IPictureDisp> pic;
LARGE_INTEGER l;
l.QuadPart =0;
pStream->Seek(l, STREAM_SEEK_SET, NULL);
OleLoadPicture(pStream, l.LowPart, FALSE, IID_IPictureDisp, (void **) &pic);
if(pic != NULL) {
pic->QueryInterface(IID_IPicture, (void **) Pict);
if(Pict) {
bResult = TRUE;
}
}
return bResult;
}
Do you see something wrong in the code ( it fails when tries to load the picture (( ).
Thanks in advance, Greetings
Braulio
|
|
|
|
|
Very first thing, I would use an HRESULT and catch the return value from OleLoadPicture. In fact you should be checking the return values of all of your COM function calls especially the ones that cross process boundaries. With COM the functions can fail due to unforeseen problems outside of your program.
after you get the HRESULT, you can test if it is valid with the SUCCEEDED(hResult) macro, or if it failed with the FAILED(hResult) macro. Also if you want to know what the error code is when it fails you can look it up in the tools menu with error lookup.
|
|
|
|
|
Thanks for the tip,
One thing... to install my COM server DLL in another computer, I only need to call
RegSvr32 MyDll.dll
Not more not less ?, or do I need to make more operations ?
Thanks !
Braulio
I
|
|
|
|
|
That should be it, but it has to be called from that computer.
|
|
|
|
|
Hi everyone. I have a dialog with a control toolbar, which I have been able to successfully create. It has 2 combo boxes, both were simple combo boxes, and it worked fine. Then, I made one of the combo boxes a CFontPreviewCombo (which is a combo box which displays all available system fonts, which is a new control added to CodeProject, by Chris Losinger). I did this by changing the type from CComboBox to CFontPreviewCombo, and it compiled and ran fine. It did display the fonts in the combo box, but box itself did not draw properly. I realized it was supposed to be owner drawn variable, so I made it owner drawn variable by using the CBS_OWNERDRAWVARIABLE style.
When I did that, I got a daocore.cpp, line 42. It asserts on the cToolBar.m_cboFont.Create() line, when the combo box is created. It does not assert when not owner drawn, but does when it is.
I have my combo box code below, I am doing this in the OnCreate() of the dialog. I was told this was the right place to put it, but I am not completely sure, I have to admit I am new to manipulating toolbars directly.
<br />
int CDlgReport::OnCreate(LPCREATESTRUCT lpCreateStruct) <br />
{<br />
if (CDialog::OnCreate(lpCreateStruct) == -1)<br />
return -1;<br />
<br />
CRect rect;<br />
<br />
<br />
cToolBar.Create(this);<br />
cToolBar.LoadToolBar(IDR_TBR_REPORT);<br />
<br />
#define SNAP_WIDTH_FONT_SIZE 50 //the width of the combo box<br />
#define SNAP_WIDTH_FONT 150 //the width of the combo box<br />
<br />
<br />
cToolBar.SetButtonInfo(0, ID_TBR_REPORT_CBO_FONT, TBBS_SEPARATOR,<br />
SNAP_WIDTH_FONT);<br />
cToolBar.GetItemRect(0, &rect);<br />
<br />
rect.top+=2;<br />
rect.bottom += 200;<br />
<br />
<br />
<br />
<br />
<br />
<br />
if (!cToolBar.m_cboFont.Create(WS_CHILD|WS_VISIBLE|CBS_AUTOHSCROLL| CBS_OWNERDRAWVARIABLE |<br />
CBS_DROPDOWNLIST|CBS_HASSTRINGS | CBS_SORT,<br />
rect, &cToolBar, IDC_CBO_FONT))<br />
{<br />
TRACE0("Failed to create combo-box\n");<br />
return FALSE;<br />
}<br />
<br />
<br />
<br />
cToolBar.m_cboFont.SetFont(cToolBar.GetFont());<br />
cToolBar.m_cboFont.ShowWindow(SW_SHOW);<br />
<br />
cToolBar.m_cboFont.m_style = CFontPreviewCombo::NAME_GUI_FONT;<br />
cToolBar.m_cboFont.Init();<br />
<br />
<br />
<br />
<br />
cToolBar.SetButtonInfo(1, ID_TBR_REPORT_CBO_FONT_SIZE, TBBS_SEPARATOR,<br />
SNAP_WIDTH_FONT_SIZE);<br />
cToolBar.GetItemRect(1, &rect);<br />
<br />
rect.top+=2;<br />
rect.bottom += 200;<br />
<br />
if (!cToolBar.m_cboFontSize.Create(WS_CHILD|WS_VISIBLE|CBS_AUTOHSCROLL| <br />
CBS_DROPDOWNLIST|CBS_HASSTRINGS,<br />
rect, &cToolBar, IDC_CBO_FONT_SIZE))<br />
{<br />
TRACE0("Failed to create combo-box\n");<br />
return FALSE;<br />
}<br />
cToolBar.m_cboFontSize.SetFont(cToolBar.GetFont());<br />
cToolBar.m_cboFontSize.ShowWindow(SW_SHOW);<br />
<br />
cToolBar.m_cboFontSize.AddString("1");<br />
cToolBar.m_cboFontSize.AddString("2");<br />
cToolBar.m_cboFontSize.AddString("3");<br />
cToolBar.m_cboFontSize.AddString("4");<br />
cToolBar.m_cboFontSize.AddString("5");<br />
cToolBar.m_cboFontSize.AddString("6");<br />
cToolBar.m_cboFontSize.AddString("7");<br />
cToolBar.m_cboFontSize.SetCurSel(0);<br />
<br />
return 0;<br />
}<br />
If I am not specific enough, I can provide more code. I hope I explained this correctly.
Thanks in advance!
|
|
|
|
|
Replace with : CBS_OWNERDRAWFIXED
my part codes:
// Create the Line Style combo box
SetButtonInfo(6,ID_PRTFMTLINESTYLE,TBBS_SEPARATOR,80);
GetItemRect(6, &rect);
rect.top = 2;
rect.bottom = rect.top + 18*8;
if (!m_LineStyleSelect.Create(
CBS_DROPDOWNLIST|CBS_OWNERDRAWFIXED|CBS_SORT
|WS_VISIBLE|WS_TABSTOP,
rect, this, ID_PRTFMTLINESTYLE))
return -1;
|
|
|
|
|
I tried making it own drawn fixed, but it also asserts
|
|
|
|
|