|
I've a crazy idea, use SetWindowRgn, let the visible part be the rgn.
======================================
[update]
I tried as below, the background of the list ctrl is still while, why the code that changes the background brush doesn't take effect?
int CThumbListCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CListCtrlHiddenSB::OnCreate(lpCreateStruct) == -1)
return -1;
DWORD dw = SetClassLong(GetSafeHwnd(), GCL_HBRBACKGROUND, (LONG)GetStockObject(BLACK_BRUSH));
SetExtendedStyle(LVS_EX_HIDELABELS | LVS_EX_BORDERSELECT);
return 0;
}
=========================================================
Here is the method I tried, but not successful:
(some error check codes are removed)
BOOL CMyWnd::PreCreateWindow(CREATESTRUCT& cs)
{
CWnd::PreCreateWindow(cs);
WNDCLASS wndclass;
BOOL b = ::GetClassInfo(AfxGetInstanceHandle(),cs.lpszClass,&wndclass);
wndclass.lpszClassName=L"classThumbListCtrl";
wndclass.hbrBackground=(HBRUSH)GetStockObject(HOLLOW_BRUSH);
VERIFY(AfxRegisterClass(&wndclass));
cs.lpszClass=wndclass.lpszClassName;
return TRUE;
}
Any way to correct it? Or is there a better way?
Thanks.
system
modified on Monday, July 14, 2008 10:59 AM
|
|
|
|
|
You Can use SetLayeredWindowAttributes.
-@SuDhIrKuMaR@-
|
|
|
|
|
It does not apply to a list ctrl, though the ctrl has WS_EX_LAYERED style.
system
|
|
|
|
|
There's nothing that says the system controls need to honor your brush.
You'll need to use owner draw/custom draw.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I am using a mybatch.bat file to execute one of my command line exe. Below I the batch file
@echo ON
App.exe %*
pause
director structure used:
c:\test\ mybatch.bat
c:\test\App.exe
When I execute this batch file from its current folder it executes the “App.exe” (for example : C:\test>mybatch.bat)
But when i run giving path, (c:\>test\mybatch.bat) in this case I am getting error as C:\>App.exe bad command. That is batch file is not executing the command c:\>test\App.exe rather it executes c:\>App.exe.
So please let me know how to take the dynamic path.
-Nand
|
|
|
|
|
I know it is a fix. Not the right way to implement. But it works. It is simple. Just try.
Follow these steps
1. Make one more folder under c:\test> as "mybatch". (c:\test\mybatch>)
2. modify your batch file as follows
@echo ON
%0\..\App.exe %*
pause
Now try the command from the root folder of c drive.
c:\> test\mybatch.bat
|
|
|
|
|
Thanks a Lot..its working fine.
-Nandu
|
|
|
|
|
Hi all!
Can anyone tell me if i could use try-catch block within a windows procedure to catch errors like
"Error occurred while creating window!" or
"Couldn't initialize COM object!"
for example my in winmain function:
try
{
SetupMessageBoxPointer();
// Initialize WinSock for peer to peer classes, and COM for ...
if (!InitializeWinSock2())
throw Error(L"Error: Cannot initialize Ws2_32.dll!", _FATAL_ERROR);
if ((hOK = CoInitialize(NULL)) != S_OK)
throw Error(L"Error: Cannot initialize COM object!", _FATAL_ERROR);
mainapp = new DataCrypt(hInstance);
if (mainapp == NULL)
throw Error(L"Cannot allocate memory for DataCrypt object!", _FATAL_ERROR);
mainapp->Initialize();
mainapp->Run(); // messages loop
}
catch(Error &err)
{
ERRORMSG(NULL, err.GetText(), err.GetErrorType());
}
|
|
|
|
|
With the code you've posted, catch block surelly handles the Error exceptions you throw; anyway Windows API (without using MFC) doesn't use exception mchanism.
|
|
|
|
|
Yes, your idea is sound. Clearly you will need to define the Error class appropriately and to enable C++ exception handling for your project. Catching exceptions by reference is also occasionaly flaky so if you find the catch part is not working then trying throwing and catching an Error pointer instead.
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
|
|
|
|
|
Matthew Faithfull wrote: Catching exceptions by reference is also occasionaly flaky
I'm not sure what you mean by this. Catching exceptions by reference (usually a const reference) is the norm.
Steve
|
|
|
|
|
I was recently looking into this because I've been implementing exception handling myself, as opposed to just using it, ( based on porting a VC6 OSS implementation). There's a set of matching rules that decide whether a particular catch handler matches a particular thrown exception. The more I looked into how to implement this the more complex I realised it is. Added to which the flags in the underlying Windows (and VC++ generated code ) exception information don't seem adequate to accurately differentiate between for example a reference to a type and a reference to a pointer type. On the basis that I could find no documentation on these rules, maybe they're buried in an appendix of the C++ spec somewhere, I determined to advise extreme caution when throwing anything other than a straight forward pointer. Plain pointers are clearly flagged in the built in data structures and can definitely be caught reliably. I need to do a good deal more investigation, and ideally get hold of the formal rules, to determine if VC++ does indeed generate enough information to fully implement them and whether MSs own exception system has any holes in this area which I strongly suspect it might. I have stuggled in the past to get catch handlers to match with anything other than very simple thrown types and now I think I know why.
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
|
|
|
|
|
Hi.
I need to disable visual style to a MFC project; that is, no window had to be rendered with visual style. I've tried the code
SetWindowTheme(m_hWnd, L" ", L" ");
in the MainFrame, but it removes the style to only the title bar.
The application is SDI with a single view and I've tried to use the above line even in the OnInitialUpdate handler, but seems it doesn't work.
Any hint?
Thanks
Atropo
|
|
|
|
|
Why do you need to do this?
Can't you use a console application?
Or is it just one single window, then again what do you want to do with it? Because the only use of an invisible window is to receive events. And this can be done by creating a CWnd dummy object.
Please clarify your needs.
Learn from the mistakes of others, you may not live long enough to make them all yourself.
|
|
|
|
|
> Why do you need to do this?
'Cause with visual styles, the appearence of the application's controls (sizes, position, ecc.) changes.
> Can't you use a console application?
No! I need to use a GUI application!!!
>Or is it just one single window, then again what do you want to do with it? Because the only use of an invisible window is to receive events. And this can be done by creating a CWnd dummy object.
> Please clarify your needs.
It shouldn't matter. I simply need a window that is rendered with the basic visual style (classic Windows XP style).
|
|
|
|
|
which version of visual studio are you using?
|
|
|
|
|
VS 2008. It includes application manifest; I thought it could be modified to disable visual styles, but I don't know how.
|
|
|
|
|
If you open the stdafx.h, you can find some statements like...
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
Comment it all. Doing so will prevent your application from creating a manifest file that have dependency with comctrl version 6.
|
|
|
|
|
It works!!!
Thanks a lot!!!!
|
|
|
|
|
how can i send a clist of cstring elements to another process using writeprocessmemory?
when i try to send the list, the list is getting copied in the dest process but i cannot access its elements (i think the elements dont get copied).
thanks
|
|
|
|
|
Why did you use such a function (Did you considered the Clipboard for such operations)?
Are you aware that, generally speaking, pointer cannot be shared by different processes?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Is WriteProcessMemory() really the interprocess communication
method you want to use?
Interprocess Communications[^][^]
Regardless, you need to serialize the strings into a byte stream somehow
and send that stream. The receiving end needs to de-serialize the byte
stream back into a list of CString objects.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
WriteProcessMemory[^] is generally used by debuggers. I'd look for another IPC method if I was you.
Steve
|
|
|
|
|
how can i check whether the audio driver installed or not(in pc) for my vc++ application?
Thnx,
Fedi
|
|
|
|
|
Perhaps the CreateFile[^] function will help. Here's a quote from MSDN:
Creates or opens a file or I/O device.
Steve
|
|
|
|