|
I am not sure where you are refering.
You have an SDI app, and that window will have a caption.
Is there another child window, and where is it?
Also, have you used Spy++ to look and the window styles to see if this child window you are refering to uses the WS_CAPTION style? Have you tried removing that style from this window in question?
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Hi,
I have a class (CVidCap) that I developed to grab frames from a Webcam and I want to make this a "dialog independent" class. When this class is created it populate a CMenu (MFC) object with all Webcam available in the system and i design a function that append this CMenu object in an application MenuBar. The problem is that when the CMenu object is attached, it is alweys GRAYED, and I can't handle any mouse button press in my class.
I'm trying to handle the application events in my independent class without insert any code in the application MESSAGE_MAP. I was clearly?
<br />
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)<br />
ON_COMMAND(ID_TESTE_B, OnTesteB)<br />
END_MESSAGE_MAP()<br />
I try to add a message map in my class but didn't work.
If anybody could help, I'll appreciate!
Thanks, and sory my english!
Marcos Vinícius
Engenheiro Eletricista
|
|
|
|
|
Like this?
pMDIFrame->GetMenu()->>AppendMenu(MF_SEPARATOR);
pMyMDIFrame->DrawMenuBar();
Sonork 100.41263:Anthony_Yio
Life is about experiencing ...
|
|
|
|
|
Yes, I try this, but the menu that I append is still grayed!!!
CMenu *Menu = Wnd->GetMenu();<br />
hr = Menu->InsertMenu(Position, MF_BYPOSITION | MF_STRING | MF_POPUP |<br />
MF_ENABLED, (UINT)DevicesMenu->m_hMenu, TEXT("Devices"));<br />
Menu->Detach();<br />
Wnd->DrawMenuBar();
The only way that they work properly is to add in the AppClass file MESSAGE_MAP the code:
<br />
BEGIN_MESSAGE_MAP(CTe13App, CWinApp)<br />
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)<br />
ON_COMMAND(ID_PAUSE, OnPause)<br />
ON_COMMAND_RANGE(ID_MENU_DIALOG0, ID_MENU_DIALOG9, OnDialog)<br />
END_MESSAGE_MAP()<br />
but I don't want to do this. I need to be App independent; to be an independent class!! Is there a way that adding a message map in my class, the app message map understand? Like this:
// file "MyClass.cpp"
BEGIN_MESSAGE_MAP(CVidCap, CWnd)
ON_COMMAND_RANGE(ID_MENU_DIALOG0, ID_MENU_DIALOG9, OnDialog)
END_MESSAGE_MAP()
Thanks
Marcos Vinícius
Engenheiro Eletricista
|
|
|
|
|
It is not neccessary to have your handler in your app class.
For instance, you can catch your menu item handler in your View.
You can have it in your CDialog , CView or CFrameWnd. Just make sure your menu ID constant to be included in the source.
Sonork 100.41263:Anthony_Yio
Life is about experiencing ...
|
|
|
|
|
It means that I always have to put some extra-code in my CDialog, CView or CFrameWnd? I can't just make an object that handle the menu messages without put any extra-code?
<br />
...<br />
private:<br />
CMyClass *MyObject;<br />
...<br />
<br />
...<br />
BOOL MyApp::InitInstance()<br />
{<br />
MyObject = new CMyClass();<br />
...<br />
}<br />
Thanks Anthony
Marcos Vinícius
|
|
|
|
|
Yes, it is possible, just that you need put in some effort.
Check Programming Windows by Charles Petzold.
|
|
|
|
|
Hello:
I´m programming my application with MFC from VC++. Unfontunly, I have a serious memory problem in my application. with every each any operation the memory grows 4k. Also, the application has to make a big numer of operations, So the memory grows until the application crash.
Any operation is made in a separate thread. The thread is created and later destroyed after each operation. It uses a pointer which references the ado connection. The entity of the connection is created in the main thread. Inside the thread, I create , open, use and close a new Recorset. The recorset uses the connection pointer to access the database.
The creation and destruction of the thread is fine, because in operations without recorset, the memory is stable. However, the threads that use recordset prevent the memory being released appropiately.
This is the code that i use to create the connection:
_ConnectionPtr pConn;
pConn.CreateInstance(__uuidof(Connection));
pConn->ConnectionTimeout = 180;
pConn->CursorLocation = adUseServer;
//open conexion
BOOL aux = S_OK == pConn->Open( _bstr_t(m_conexion) , L"", L"",adOpenUnspecified);
This is the code that i use to create the recorset:
//******
_CommandPtr pCmd_SP;
pCmd_SP.CreateInstance(__uuidof(Command));
//establezco conex con comando
pCmd_SP->ActiveConnection = pConn;
// seteo sql
CString instruccion = "execute storeprocedureX";
pCmd_SP->CommandText = (_bstr_t) instruccion ;
// Create the variant NULL
_variant_t vNull;
vNull.vt = VT_ERROR;
vNull.scode = DISP_E_PARAMNOTFOUND;
// creo el Rs
_RecordsetPtr pRs_SP;
pRs_SP.CreateInstance(__uuidof(Recordset));
pRs_SP->CursorLocation = adUseClient;
pRs_SP->PutRefSource(pCmd_SP);
// Open the recordset
pRs_SP->Open(vNull, vNull, adOpenForwardOnly, adLockOptimistic, adCmdUnknown);
pRs_SP->Close();
Would you please help me to solve this problem?
Thanx
|
|
|
|
|
To add information, now , i´m looking that the application grows 4k(in ram memory) with each: pConn->Execute(.....); , that happend when the execution is inside a child thread, but not when it´s in the main thread.....
I don´t know realy how to clean the memory....
|
|
|
|
|
To Add intormation I´ve posted here: http://www.codeproject.com/threads/work_queue.asp#xx814717xx
PLEASE I NEED A SOLUTION!!!!
|
|
|
|
|
I have developed an MFC application which reads data from a Joystick (x, y, z and 4 buttons).
All the data regarding the joystick is displayed on the dialog.
However what I would like to do is convert this Joystick EXE into a DLL with some functions calls to access the Joystick data. This would allow other applications to obtain the Joystick data.
What I did not want to do was include all the bits required (from the original MFC Joystick application) into any applications that needed the Joystick information.
Now my question is can this Joystick MFC application be converted into a DLL; can you include function calls to make the dialog visiable or hidden as required from the EXE applications that use this DLL.
i.e. are they any limitations on the DLL that I have to take into account. The Joystick code uses Windows Messages JOY1MOVE, JOY1BUTTONUP etc and timers.
grahamfff
|
|
|
|
|
Definitely. Check out MFC extension DLL.
http://www.mindcracker.com/mindcracker/c_cafe/dll.asp
Check out my website for more software development links.
http://www.dslextreme.com/users/kuphryn/links.html
Kuphryn
|
|
|
|
|
i have a list box,edit box and a button named add.
The problem is the code i wrote for the add button which takes the string entered in the edit box keeps it in the list box.
My problem is when i double-click on a item in the listbox,i should be able to edit that string and when i am done,the new string should be there instead of the previous one.
How can a listbox get the properties of an edit box?
ASAP!!
thanx
|
|
|
|
|
Ok, so what's the problem/question? Why not provide a code snippet that can be critiqued?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Click this link[^] and you may find what you need.
|
|
|
|
|
I have a small contract to slightly alter a piece of software that I own to adapt it to the needs of a client. Does anyone know if there is any precedent for who by default has the intellectal property in this case? Would I have to specify this in the invoice that it in no way represents a transfer of IP if I wanted to keep control of the software even after the modification were made? The client is in Europe.
|
|
|
|
|
My guess would be that they would own the rights to the modification, but not the core component.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Unless otherwise stipulated, you would likely retain ownership of the intellectual property. For safety, however, you should create a contract that clearly specifies this.
(If the creative forces reside in the contractee and you work exclusively for them, even if a contractor, the work would likely be classified as "work-for-hire" and the contractee would own the copyright and intellectual property, but that doesn't sound like your situation.)
Also be aware that any translations are copyrighted separate from the code by the translator. Be sure you get a signed contract assigning copyright back to you in this case.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
I'm wondering about a behaviour with MFC application on a CDialog concerning the mnemonic.
I always thought that an object(e.g. a CButton)'s
function is executed when pressing ALT+Mnemonic.
Now I saw that the function is executed if the focus is in a non-entry control (like a CButton) without pressing the ALT key.
Is there a chance to avoid this behaviour and only execute the function by using ALT+Mnemonic?
|
|
|
|
|
I'm not a 100% sure but I think this is the default behaviour
if the focus is set to a non-edit control.
Maybe you can change this behaviour by overriding PreTranslateMessage,
but I am only guessing...
Jens
|
|
|
|
|
Does 'EnumDesktopWindows' is not supported in windows 95/98 ?
If not - How else can i get a handle to the windows currrently running ?
|
|
|
|
|
Avi Strul wrote:
Does 'EnumDesktopWindows' is not supported in windows 95/98 ?
Correct, it is not supported on those platforms.
Avi Strul wrote:
If not - How else can i get a handle to the windows currrently running ?
Please indicate what problem you are attempting to solve, and we might be able to offer a solution that does not depend on EnumDesktopWindows() .
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I am trying to write a browser monitor. If i could get a handle to the current open windows then I can decide whether it is a browser , if it it - then look on the window control to look for the site that is currently being viewd.
|
|
|
|
|
It would be much easier to write a Browser Helper Object (BHO). There are examples here at CP. You can also Google for more.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hi all,
I would like to be able to turn off/on the monitor programmatically.
In fact, I can do that with this piece of code:
HWND hWnd = GetSafeHwnd();
::SendMessage(hWnd, WM_SYSCOMMAND, SC_MONITORPOWER, MONITOR_OFF);
The problem is when the mouse is moving, the display is turning on back.
I tried to use a global mouse hook (implemented in a DLL) which is called and enabled by my main MFC application. The hook works great !
Then, in my application, I have this :
InstallHookMouse(); // Install mouse hook which lock all mouse messages
DisplayOff(); // Turn off the monitor
When I move the mouse while the display is turned off, it turns on back.
Have I to program a mouse filter driver to lock definitively this mouse and then, the monitor will not turn on back (until my application will decide to turn it on), or is there another solution ?
Thanks.
|
|
|
|