|
problem:
i need different-shaped buttons to be placed in client area in runtime.
for example:
rightclick in client area opens context menu with options:
round button
triangle button
by clicking on one of the above appropriate button shoud be drawn in client area. this button (like all others created this way) should have all standard properties of a button (CButton)
my experiment:
i've tried with SetWindowRgn but id doesn't work
then i used "common" CreateWindow with BUTTON as parametar and got a nice round button but my program wouldn't accept any further rightclicks (no context menu)
this is my method wich creates squared flat button
(i could create many buttons)
void CpaintView::OnFalseCircle()
{
CPoint point;
GetCursorPos(&point);
ScreenToClient(&point);
CButton *cir = new CButton();
cir->Create("tri",BS_FLAT, CRect(point,CPoint
(point.x+20,point.y+20)),AfxGetMainWnd(),1);
cir->ShowWindow(SW_SHOWNORMAL);
}
and non-working method wich creates one circle and stucks
void CpaintView::OnCircle()
{
CPoint point;
GetCursorPos(&point);
ScreenToClient(&point);
CRect rect(point, CPoint(point.x+50, point.y+50));
CRgn rgn;
Circle *cr = new Circle();
rgn.CreateEllipticRgnIndirect(rect);
SetWindowRgn(rgn,true);
CreateWindow("BUTTON","",WS_CHILD | WS_VISIBLE, point.x-10,point.y- 10,70, 70, *this,(HMENU)101,0,0);
}
thanks
|
|
|
|
|
I am having difficulty with the Microsoft NTFS DACL calls, specifically GetNamedSecurityInfo and GetExplicitEntriesFromAcl. I am using VC++ version 6. I have searched the internet thoroughly, and have found several examples of using GetNamedSecurityInfo but haven't found any examples of how to us GetExplicitEntriesFromAcl. My code seems to get the DACL from GetNamedSecurityInfo okay, but I don't now how to get the individual entries from the pointer to an array of DACLs from the GetExplicitEntriesFromAcl function. I need to roll my own "get NTFS permissions" function to include in other C++ programs. I am just getting up to speed on C++, and need a little tutoring on pointers and pointers to arrays. I believe that GetExplicitEntriesFromAcl returns a pointer to an array of DACLs, as well as the number of DACL entries. An example of how to extract the DACL entries from the pointer information would be appreciated.
|
|
|
|
|
The following code was found in none of the Codeguru thread.
This code is written in c++ and console application and my application is .Net dialog based application.
Could you please help me how to convert the following code to c++.Net . ?????????????????????
<br />
#include <windows.h><br />
<br />
#define DIVISIONS 5<br />
<br />
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;<br />
<br />
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,<br />
PSTR szCmdLine, int iCmdShow)<br />
{<br />
static TCHAR szAppName[] = TEXT ("Checker2") ;<br />
HWND hwnd ;<br />
MSG msg ;<br />
WNDCLASS wndclass ;<br />
<br />
wndclass.style = CS_HREDRAW | CS_VREDRAW ;<br />
wndclass.lpfnWndProc = WndProc ;<br />
wndclass.cbClsExtra = 0 ;<br />
wndclass.cbWndExtra = 0 ;<br />
wndclass.hInstance = hInstance ;<br />
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;<br />
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;<br />
wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;<br />
wndclass.lpszMenuName = NULL ;<br />
wndclass.lpszClassName = szAppName ;<br />
<br />
if (!RegisterClass (&wndclass))<br />
{<br />
MessageBox (NULL, TEXT ("Program requires Windows NT!"), <br />
szAppName, MB_ICONERROR) ;<br />
return 0 ;<br />
}<br />
<br />
hwnd = CreateWindow (szAppName, TEXT ("Checker2 Mouse Hit-Test Demo"),<br />
WS_OVERLAPPEDWINDOW,<br />
CW_USEDEFAULT, CW_USEDEFAULT,<br />
CW_USEDEFAULT, CW_USEDEFAULT,<br />
NULL, NULL, hInstance, NULL) ;<br />
<br />
ShowWindow (hwnd, iCmdShow) ;<br />
UpdateWindow (hwnd) ;<br />
<br />
while (GetMessage (&msg, NULL, 0, 0))<br />
{<br />
TranslateMessage (&msg) ;<br />
DispatchMessage (&msg) ;<br />
}<br />
return msg.wParam ;<br />
}<br />
<br />
<br />
|
|
|
|
|
The following code was found in none of the Codeguru thread.
This code is written in c++ and console application and my application is .Net dialog based application.
Could you please help me how to convert the following code to c++.Net . ?????????????????????
[code]
#include <windows.h>
#define DIVISIONS 5
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
static TCHAR szAppName[] = TEXT ("Checker2") ;
HWND hwnd ;
MSG msg ;
WNDCLASS wndclass ;
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc = WndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = szAppName ;
if (!RegisterClass (&wndclass))
{
MessageBox (NULL, TEXT ("Program requires Windows NT!"),
szAppName, MB_ICONERROR) ;
return 0 ;
}
hwnd = CreateWindow (szAppName, TEXT ("Checker2 Mouse Hit-Test Demo"),
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hInstance, NULL) ;
ShowWindow (hwnd, iCmdShow) ;
UpdateWindow (hwnd) ;
while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
}
return msg.wParam ;
}
[/code]
|
|
|
|
|
Anonymous wrote:
This code is written in c++...
Actually, it's just plain C code, using the Windows SDK. I've yet to use anything .Net, but plenty of folks here do. Perhaps this forum could also help.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Thank you David. I'll post my message over there and see who can help me.
Thank you again.
|
|
|
|
|
Friends,
Can anyone write me a small program in Vc++ to trap a keyboard event and focus it to a desired window, say ms word.
|
|
|
|
|
Check out SetWindowsHookEx(WH_KEYBOARD, ...) . Once you have that working, then we can focus on sending messages to other applications.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I have a plan to develop a Network Application. Suppose I have a class CServerData with a member function likes: CString CServerData::GetString()
Here is a pseudo implementation of GetString
function:<br />
CString CServerData::GetString(){<br />
1. Connect to Server<br />
2. Send a request to Server<br />
3. Wait until server answer<br />
4. Return a CString<br />
}<br />
So that, in anywhere, I can write:
<br />
CServerData server;<br />
CString st=server.GetString();<br />
If I use CSocket, How can I implement that?
It is better if you can give me a detail example.
Thanks for reading.
|
|
|
|
|
Why reinvent the wheel? How about just using NetServerGetInfo(..., 101, ...) ?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
For the most part, I work in a bubble and can usually work things out over time. However...
I have a Client/Server application using DCOM where I would like a client to signal the server that it is done with certain operations and now notify all other clients of changes and updates. The notification message is short - a Client ID and a BSTR (< 255 characters) and the client's response is typically short, quickly returning an HRESULT to the server. I am able to make "Connection Points" work fine for two or three clients. When more clients are connected though, things bog down.
Correct me if I am wrong, but COM is sychronus which means that all clients must be notified via a Fire_XXX function before returning to the originating client. This turns out to be well over a minute in some cases! Users believe the program has locked up and take matters into their own hands (torches, clubs, pitch forks - storm the castle).
I have setup the notification method on the server side to bracket the call to the Fire_XXX function in a secondary thread allowing quick return to the client requesting notification. This works much better, but I am unsure if this is the best approach.
I have being trying to find information on "Loosely Coupled Events" without much success. Any guidance or suggestions would be greatly appreciated.
Ross
Ross White
|
|
|
|
|
Greeting, we are college students from Taiwan, here have some problem and wish to get help here, thank you for your reading and answer.
We wish to create a human-face image on PDA, and now we separate the face into some individually images, like hair, eyes, nose and mouth...
Our goal is to treat all the individually images as particular objects, and could drag them into a main working space (a larger image place), then could save them into a single image files.
1. How to control the object with the code that could move and transform the object feely?
2. How should we design the program to let the user could draw and to alter the images like in painter?
3. Would anybody please tell us where could we inquire about the information about GPRS upload program?
The program coder we use is EVB; we sincerely wish you could help us.
|
|
|
|
|
i want to find a library about wav convert to midi(language : c++)for windows 2000.
|
|
|
|
|
learn the theory about sound storage then you will see how silly your question is!
Don't try it, just do it!
|
|
|
|
|
|
Hy!
I have a project and I must simulate operations on Binary Search Trees.
I have a problem animating some rectangles (moving them around an displaing them as they move).
Can someone tell me how to do this?
cata
|
|
|
|
|
How do you find a programs memory allocation? Like if we wanted to hook a game by injecting a .dll file into the memory, we need the memory allocation, do you need to debug or something, please give directions
|
|
|
|
|
Opwar wrote:
How do you find a programs memory allocation?
See if this article helps. If not, I'm failing to understand your question.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I have created a single document application with MFC wizard. I want to capture file name being opened when user selects a file and opens it through the file open dialog box. How can I do this?
Thanks
|
|
|
|
|
CDocument::GetPathName() after document is opened
You can override CDocument::OnOpenDocument() to do the open--I've done this many, many times. (I suggest overriding this, calling the base class, then stepping through the code to understand what the base class is doing [with dirty flags and all that.])
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
|
Hello. I have tried to build my project which references msxml4.dll but when I try to build it I get the following error:
Cannot open type library file: 'msxml4.dll'
I can manage to find this on the Internet I think but should I just put it somewhere in my path or is there a proper way of installing it along with maybe an SDK? I have tried installing the Internet SDK but it does not install the file I want. I have tried searchig for it on my hard disk after installing the SDK but it is not there.
Thank you for any help.
|
|
|
|
|
Where/how are you referencing msxml4.dll?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Thank you for your reply.
It is in my stdafx.h file but I have been looking for information and I have seen that it is provided as part of the operating system I think. I think my problem is that I am on Windows 2K so the version is not the one I am making a reference to. I have changed it now to msxml3.dll and it now builds. I wonder how easy it is now to upgrade to msxml4.dll. Is this just installing MS XML Parser 4.0?
|
|
|
|
|
Hi,
I would like to know if there is any function (while reusing the webBrowser control) that give me the ability to add headers in every request that makes my application using the webBrowser control.
I would appreciate any help..
Thanks in advance!
-Manos Moschous
|
|
|
|
|