|
Shog9 wrote:
a flag is passed along with it to allow them to distinguish which is which.
Gawd, I'm such a dork for not reading the manual ... I've been doing a lot of junk code just to do this !
Thanks!
Max.
|
|
|
|
|
how can u remove your application from taskbar?
thanks
norm
|
|
|
|
|
|
trying to draw on top of a button
CRect * prtExit = NULL;
CDC * pExitDC = NULL;
CWnd * pbtnExit = this->GetWindow(IDC_EXIT);
pExitDC = pbtnExit->GetDC();
pbtnExit->GetClientRect(prtExit);
pExitDC->TextOut( prtExit->left+5, prtExit->top+5, "Testing");
//I understand we dont need to text out and there's simpler way to do this, but I am just testing to see if I have control over the device context of a button. I was going to load a bitmap (I also know about BM_SETIMAGE...)
Anyway, the code crashed: "The memory could not be read".
By the way, this is done in dialog class constructor... is it possible that the button has not been constructed yet...?
norm
|
|
|
|
|
just tried to render a bitmap on face of a button, crashed the very same way: memory access:
HBITMAP h_bmpExit = NULL;
h_bmpExit = (HBITMAP) ::LoadImage(AfxGetInstanceHandle(), "./res/StopButton.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION);
if(h_bmpExit==NULL)
{
//Additional error handling here!
}
pbtnExit->PostMessage(BM_SETIMAGE, IMAGE_BITMAP, (LPARAM) (HANDLE) h_bmpExit);
norm
|
|
|
|
|
|
I want to use SetLayeredWindowAttributes(...), I looked it up from MSDN and here's what I need:
1. Header Declared in Winuser.h, include Windows.h
2. Import library User32.lib
3. Minimum operating systems Included in Windows 95, Windows NT 3.1
(QUESTION 1) How can I "import" a library? I already tried "Add To Project>Files", it didnt work?
(QUESTION 2) it seems like Intellisense doesnt know about SetLayeredWindowAttributes()
Thanks!
URL to MSDN:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/Windowing/Windows/WindowReference/WindowFunctions/SetLayeredWindowAttributes.asp
Link to code project article: http://www.codeproject.com/win32/Quaker1.asp?print=true
norm
|
|
|
|
|
norm wrote:
QUESTION 1) How can I "import" a library? I already tried "Add To Project>Files", it didnt work?
Nope - you go to the project settings and add it as an additional library, or include the directory it's in into your library paths. The version you have should be linking already, and if you can't see it, chances are you need a newer SDK, although you shouldn't if it comes with W95.
norm wrote:
QUESTION 2) it seems like Intellisense doesnt know about SetLayeredWindowAttributes()
Intellisense without Visual Assist is useless. Much as I hate to promote them since they want to charge me for moving to .NET, their product under VC6 is still indispensable.
It's also my recollection that this function is useless - which is why you don't see translucent windows on systems less than W2000, where it's supported nicely.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
sorry, I tried to look for a place where i can specify imports under project setting, but not with much luck.
can u be a bit more specific about how to import a library?
norm
|
|
|
|
|
I just got this and see it was answered in the meantime.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
SetLayeredWindowAttributes is only supported on Windows 2000 or greater therefore you will not see it on an older operating system. If you are building for windows 2000 or greater, you will need to define _WIN32_WINNT = 0x0500, otherwise the preproocessor will remove all of the API definitions that are only available on Windows 2000 and above. Coincidentally this will cause runtime error if you run one of these programs on a system that has an older DLL version.
As far as linking a library to your project, you can do it the way that you specified, or you can go to the linker tab of your projects settings, and add the name of the lib to your project. However most likely you are already linking user32.lib into your program if your program already has a user interface.
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!
|
|
|
|
|
QUESTION 1:
#define _WIN32_WINNT = 0x0500
and why? It's not in the api documentation??
QUESTION 2:
What do I type in project>setting>"link" tab>"object/library module" ??
"./user32.lib"
Is this right? Do I have to include quotation mark?
QUESTION 3: I downloaded a sample that uses LoadLibrary.
# define LWA_COLORKEY 1
# define LWA_ALPHA 2
# define WS_EX_LAYERED 0x80000
HWND hWnd=this->m_hWnd;
typedef DWORD (WINAPI *PSLWA)(HWND, DWORD, BYTE, DWORD);
PSLWA pSetLayeredWindowAttributes;
HMODULE hDLL = LoadLibrary ("user32");
pSetLayeredWindowAttributes = (PSLWA) GetProcAddress(hDLL,"SetLayeredWindowAttributes");
if (pSetLayeredWindowAttributes != NULL) {
pSetLayeredWindowAttributes(this->m_hWnd, RGB(255,255,255), 100, LWA_COLORKEY|LWA_ALPHA);
}
It claims that the code wont crash even if run on Win98 or platform that doesnt support SetLayeredWindowAttributes and transparency.
U think it's a good idea?
norm
|
|
|
|
|
btw, i've got the code working via LoadLibrary. it's more versatile too.
i'm still interested to see how to statically linked library to your module via project>setting>link tab
norm
|
|
|
|
|
Hi.
Okay. I would like to ask a question that I know is quite popular among MFC Windows developers. It holds the key to some very cool GUI features when implemented correctly.
I would like to know, How do you resize and reposition objects inside of a CFormView (apply to resizable dialog box as well) as the user resizes the main frame? For example, given there is an edit view inside a formview. As the user resizes the frame, I would like to the expand or contract the edit box. Another example in the same scenario is repositioning the entire edit box or a button according to how the user resizes the formview.
Thanks,
Kuphryn
|
|
|
|
|
The frame/view receive a WM_SIZE message, you handle it, and use MoveWindow on each controls ( objects ) to their new position and size, or look around here on codeproject, people already did some auto-position/size classes that do that automatically.
Personally, I use resizing sparingly, I try to build my UI in a way that the default size is good for the data to be inputed or viewed. resizing doesn't give "more" to the user.
Max.
|
|
|
|
|
|
Just out of curiousity, what is the difference between MoveWindow() and SetWindowPos()?
Kuphryn
|
|
|
|
|
MoveWindow sends other messages, WM_WINDOWPOSCHANGING, WM_WINDOWPOSCHANGED, WM_MOVE, WM_SIZE, and WM_NCCALCSIZE. SetWindowPos does not.
I prefer MoveWindow because I can handle those messages so I can manage the sizing myself of the child windows.
Max.
|
|
|
|
|
|
Hi guys:
Does anyone know where IE stores the information in the History popup window, what the format of that file is, and under what conditions it's possible to change it. (or is it?) Basically I want to change what's displayed in-place... I was thinking of just subclassing that window, but a cleaner way would be to change the file itself... any ideas?
Thanx
----------------------------------------
----I said my name wasn't important
---------------------------SlartiBartFast
|
|
|
|
|
No guru here, it's newbie stuff. The history is of course a tree folder with internet shortcuts. To get it without hardcoding a path (changing depending on the OS), use the shell API ::SHGetFolderPath with CSIDL_HISTORY as parameter.
How low can you go ? (MS rant)
|
|
|
|
|
If you want manipulate the history, you should use the IUrlHistory[^] interface to do it properly.
-- ian
"The greatest danger to humanity is humanity without an open mind." - Ian Mariano
http://www.ian-space.com/
|
|
|
|
|
Hi again:
Thanks for the responses. A couple questions:
1. I need this to work for IE5, and according to MSDN the IUrlHistory interfaces require 5.5 minimum.
2. The History "folder" is kind of weird -- I have a strong suspicition it's actually a file, shown as a folder through the use of shell extensions, or something like that. In other words, I don't think I can just enum files inside that folder, looking for ones I want to change. Am I wrong?
Any other ideas?
Thanks,
Gene
----------------------------------------
----I said my name wasn't important
---------------------------SlartiBartFast
|
|
|
|
|
I'm working on a GINA replacement, because we need to do some custom log on of the users.
I have one major problem that I can't find any solutions for.
When the user is logged on, the start-menu is, err..., not exactly disabled but it's acting very strage.
Fucus is not folloving the mouse, and it don't respond to mouse clicks.
Anyone got an idea?
I have been searching google and found other people with the same problem, but not any solutions.
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Are you sure you setup proper security descriptors for the WinSta0 and WinSta0/Default windowstation/desktop objects?
Seems that the user account the shell process is running under has not the proper access rights to create menus.
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|