|
void CMainFrame::OnShowAllBar()
{
// TODO: Add your command handler code here
m_bColorVisible = !m_bColorVisible;
ShowControlBar(&m_wndAllBar,m_bColorVisible,FALSE);
RecalcLayout();
}
void CMainFrame::OnUpdateShowAllBar(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable();
pCmdUI->SetCheck(m_bColorVisible ? 1 : 0);
}
|
|
|
|
|
That hasnt worked for some reason. HOwever I think i may have a way around it. How can i get the current state of a toolbar in a variable whether bool or int.
Like
m_myVar = ...state of bar....;
.NET or not .NET? MFC is the question......
|
|
|
|
|
BOOL bVisible = ((m_wndMyBar.GetStyle() & WS_VISIBLE) != 0);
|
|
|
|
|
Why doesn't BN_CLICKED work when I try to handle a click event on a CStatic control that shows a bitmap??
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
Try setting the SS_NOTIFY style for the CStatic and handling STN_CLICKED instead.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Damn thank you!
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
By chance, does anyone know how to cancel a printer call IF there is no printer or if it can not print due to no pare or whatever?
Thanks
|
|
|
|
|
I was wondering if there is anyway to run a exe and then for it NOT to have a button on the task bar? I want to have my main program run a separate program which will be shown and hiden from that program only.
Also, if I only want to be able to start an instance of this program once, is the best way adding a semaphore? Then I would show and hide by sending messages to it via a stored ptr to the process?
Last question. I have a problem with setting my program as the topmopst window. When I do this, if I then try ot print and if the printer is not there, the dialog that cancles the job is not shown because it it beneath this. How would I deal with this? I have tried to deal with it via checking the printer but I have not found a way to do it. The other way would be to deal with the topmost window issue.
Thanks in advance. Appreciate any bits and help.
|
|
|
|
|
Dont know if this works, but try to configure your window as a child window, with the desktop as its parent. You can get the parent's HWND by using GetDesktopWindow().
|
|
|
|
|
I think you can try ModifyStyleEx(WS_EX_TOOLWINDOW,0,SWP_FRAMECHANGED) to prevent the main window of your program from appearing in the taskbar.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Make you primary window the child of a top level invisible window.
Nish
Bow wow wow,
Yippee yo yippee yay,
My miniputt high,
Is now 30 yay.
|
|
|
|
|
Hi,
I'm looking for a way to launch VBScript from external application.
Actually the whole idea is to add toolbar to the visual studio environment (which I already did) and open a dialog to collect information from the user and then generate VBScript macro code according to this information and then execute the new macro.
I stuck in the last stage of launching the macro.
If you have any idea's I'll be grateful.
Thanks
Didi Gurfinkel
|
|
|
|
|
Hello,
i am trying to make a small benchmark application to figure out how much resources the programs i write consume, and i wonder what is the best way to do it.
I curently use the windows performance counters that are accessed via the registry base.
For exemple, to retrieve infos about the memory, i open the "VMM" perf counter, and query the values i need...
But, there is at least another way to do it :
using the GlobalMemoryStatus (MEMORYSTATUS mem_stat); function provided by Windows.
So, i would like to know what is the best way to go ? and what are the diferences between these two methods ?
Are there other ways to do this ? are they better ?
Thanks in advance,
Lion.
|
|
|
|
|
Hello
Anybody knows how to run program EXE from
resources having it loaded.
Without previous saving on disk.
Thanks
Konrad
|
|
|
|
|
Hello Konrad,
The source below shows how you can load the binary data of an EXE stored as a resource. After saving it to disk, you can run it via CreateProcess(), etc. The example saves CALC.EXE as resource type "EXEBIN" and of name "EXEBIN_CALC".
However, if you already know how to load a binary resource already and your aim is to run the binary data directly from memory, I do not think this would be possible.
With careful plumbing, you may be able to load some binary code from your EXE/DLL resource and execute it. This would still entail quite a number of restrictions, however.
#include <windows.h>
#include <stdio.h>
void main()
{
HRSRC hResourceThis = NULL;
HGLOBAL hGlobalResource = NULL;
LPVOID lpvResource = NULL;
DWORD dwLastError = 0;
hResourceThis = FindResourceEx
(
(HMODULE)NULL, // resource-module handle
(LPCTSTR)"EXEBIN", // pointer to resource type
(LPCTSTR)"EXEBIN_CALC", // pointer to resource name
(WORD)MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL) // resource language
);
if (hResourceThis)
{
hGlobalResource = (HGLOBAL)LoadResource
(
(HMODULE)NULL, // resource-module handle
(HRSRC)hResourceThis // resource handle
);
lpvResource = LockResource (hGlobalResource);
if (lpvResource)
{
FILE* fpw = NULL;
fpw = fopen ("c:\\resource_calc.exe", "wb");
if (fpw)
{
fwrite (lpvResource, sizeof(BYTE), SizeofResource(NULL, hResourceThis), fpw);
fclose (fpw);
}
}
}
if (hResourceThis)
{
CloseHandle (hResourceThis);
hResourceThis = NULL;
}
}
Hope the above helps, Konrad.
Best Regards,
Bio.
|
|
|
|
|
Hi, how do we change control properties on the run time? Say, when I click a button (caption="Start"), the button caption will change to "Stop", or it will hide other controls. And how do we know the legal properties of a control?
It`s so simple if I use VB6 but I don`t know how to do it with VC++. Thanks so much!
Regards,
|
|
|
|
|
You can use the functions GetWindowText and SetWindowText to change the caption of the button. You will want to do this in your handler for the WM_COMMAND message that has the same ID as your button control.
Chances are, that the same properties that you were able to use in VB are available when you program in C++. However, there is no easy way to see the properties that are available for a control. You will need to look in MSDN for more information on each control.
If you want to know how to hide controls you can use:
ShowWindow(hWnd, SW_HIDE);
where hWnd is the control that you want to hide. If you are doing this in a dialog box and you need to get the handle to one of your controls, use GetDlgItem . You pass the handle to the dialog that owns the control, and the control ID to this function, and it will return the handle to the control.
If you want to make that window appear again call:
ShowWindow(hWnd, SW_SHOW);
|
|
|
|
|
I'm trying to create a dialog bar with a tab control on it. Works well, both dialog bar and tab control are in place. Now in order to show something in the tab control, I show/hide dialogs. The problem is that the dialogs are located on the top left corner of the tab control, hiding the tabs. Any suggestions how to solve this?
I do it this way:
TabControl=(CTabCtrl*)DialogBar.GetDlgItem(IDC_TABCONTROL);
TabControl.InsertItem(0,"Test");
Pane1.Create(IDD_PANE1,TabControl);
Pane1.ShowWindow(SW_SHOW);
|
|
|
|
|
I want to know how to process a Word document using VBA.Can you tell me where are the information?thank you!
Besides VBA,which tools can do the same work,SQL?c++builder?
If you can find information about this,please tell me.
For i know little English,I hope you can tell me the particular web sites.Thank you very much!
huang chun shen
|
|
|
|
|
I want to know how to process a Word document using VBA.Can you tell me where are the information?thank you!
Besides VBA,which tools can do the same work,SQL?powerbuilder?
If you can find information about this,please tell me.
For i know little English,I hope you can tell me the particular web sites.Thank you very much!
|
|
|
|
|
What I have is a CAsyncSocket that listens for connections and creates another CAsyncSocket* using new to accept each incoming connection. Now when one of these new CAsyncSocket objects gets an OnClose() it needs to be deleted but you can't very well just 'delete this' since you are inside of the object itself. I am currently sending a message to my main wnd which then deletes it. This seems like a very sloppy way to me. Is there a PROPER way to do this that I might be overlooking?
Thanks,
Jack
|
|
|
|
|
You can always do this from within any class :-
delete this;
Nish
Bow wow wow,
Yippee yo yippee yay,
My miniputt high,
Is now 30 yay.
|
|
|
|
|
Thanks Nish,
I don't know why it didn't work for me before. Must have been some other error and I assumed you couldn't delete this.
-Jack
|
|
|
|
|
/moliate said
Of course you can't do it (call delete this) from inside a member function
You can do it inside of a member function, you just will not be able to call any more of the member variables for you class after you call delete . In fact the only way that delete this would work is if you were inside of a member function of that class. Otherwise the this pointer would not be valid.
Think about Release() in the IUnknown interface of COM, if you are familiar with this, it will call delete this if the reference count for its object reaches 0.
|
|
|
|
|
moliate wrote:
Of course you can't do it from inside a member function
On the contrary it is the reverse.
You can only do a delete this from a member function. Anywhere else this has no meaning.
Nish
Bow wow wow,
Yippee yo yippee yay,
My miniputt high,
Is now 30 yay.
|
|
|
|