|
All is ok!
Thank you very much!
Thanks!
Respectfully Yours,
LeonOrient
|
|
|
|
|
Hi,
I am already confused on how to get the coordinates of control in a view. I understand that I need to use:
ClientToScreen, ScreenToClient, GetClientRect, GetWindowRect but still I cannot get the correct information.
I have a MultiView using CsplitterWnd that is why I get incorrect information because it is it also reads the other view (left view) plus the right view (with button). I'm thinking If I can get to focus on only one view, I can get the correct coordiantes of the button or maybe get the width of the left and subtract it with right view.
I hope someone knows these problem.
|
|
|
|
|
GetClientRect() get the rect of the control/view/window in which you are writing this code. (So if you are in a CDialog, it will return your dialog rect, if you are in a CButton class, it will return the Button rect). Coordinates begin with (0,0). It is the size that your control has in the resource editor.
GetWindowRect() get the window rect on the screen. If your window client rect is (0,0,10,10) and the top left corner is placed at coordinates (20,15) on the screen, then the function will return (20,15,30,25)
To get the client rect of a CButton from within your CDialog class, do m_button.GetClientRect().
~RaGE();
|
|
|
|
|
Hi,
just wondering if anyone can give me some sample source code in VC++ for
device driver installer(installing .inf files).
thanks heaps
|
|
|
|
|
If I have a ComboBox, how can I modify a context menu of the editor of this ComboBox (I known that a combobox is combined by a Listbox and a edit). Please help me! Thanks
Never say Goodbye!
|
|
|
|
|
I'm also new in mfc but I'll try to answer your question. There are two ways to do that.
First:
Under Classview, right click any combo box, click properties. Under Data tab, Enter data in the edit box. After entering data, press CTRL+ enter.
Second:
Use this commandin inialization of the application:
GetDlgItem(IDC COMBOBOX ID)->AddString("Data you want to put in)
Hope it's correct.
|
|
|
|
|
Thank you, but it's not my question. I don't want to get the answer for how to insert a string to the editor of a combobox. Which I want is how to MODIFY THE MENU OF THE EDITOR OF A COMBOBOX.
Thanks
Never say Goodbye!
|
|
|
|
|
Off the top of my head (I've never had to do this) you'll probably have to subclass the edit control within the combobox, and write your own context menu handler for it.
Spy++ will give you the info you need to see what IDs are normally offered by the context menu, and the ID of the edit control itself.
Good luck!
Anna
Homepage | My life in tears
"Be yourself - not what others think you should be"
- Marcia Graesch
"Anna's just a sexy-looking lesbian tart"
- A friend, trying to wind me up. It didn't work.
Trouble with resource IDs? Try the Resource ID Organiser Visual C++ Add-In
|
|
|
|
|
Thank for your help. Last time when I visit a site, I found a code:
<br />
CComboCox combo;<br />
CMyEdit edit;<br />
POINT tmpPoint = {1,1};<br />
edit.SubclassWindow( combo.ChildWindowFromPoint(tmpPoint)->GetSafeHwnd() );<br />
I think after subclass a Edit (by CMyEdit),I can do something... but there is a error. The debug stop on the command
<br />
ASSERT(FromHandlePermanent(hWndNew) == NULL);<br />
in the function
<br />
BOOL CWnd::Attach(HWND hWndNew)<br />
Can someone help me?
Never say Goodbye!
|
|
|
|
|
It sounds like the window has already been subclassed - you'll get this error if you call SubclassWindow() twice.
Anna
Homepage | My life in tears
"Be yourself - not what others think you should be"
- Marcia Graesch
"Anna's just a sexy-looking lesbian tart"
- A friend, trying to wind me up. It didn't work.
Trouble with resource IDs? Try the Resource ID Organiser Visual C++ Add-In
|
|
|
|
|
So what the solution for my problem? Waiting for a best answer!
Never say Goodbye!
|
|
|
|
|
I thought I already had. The ASSERT you saw was because the window already had an entry in the handle map...and this will happen if you subclass it twice.
Is that the case?
Anna
Homepage | My life in tears
"Be yourself - not what others think you should be"
- Marcia Graesch
"Anna's just a sexy-looking lesbian tart"
- A friend, trying to wind me up. It didn't work.
Trouble with resource IDs? Try the Resource ID Organiser Visual C++ Add-In
|
|
|
|
|
Dear Friends
I Wish to add some features to an existing Active-X Control and then use it in Visual Basic.
Pl Help.......
|
|
|
|
|
hello i need help,i want to read .bmp or .gif or .jpg or other picture file to clipboard.who can help me..thank you
|
|
|
|
|
First you need to get hold of a class that can read in the file type you want to use. I beleive that soem are available here on CP. After that, once loaded you should have a handle to a HDIB which can be placed on the clipboard something like this:
BITMAPINFOHEADER header;
header.biWidth = m_sizes.cx;
header.biHeight = m_sizes.cy;
header.biSizeImage = 3 * m_sizes.cx * m_sizes.cy;
header.biSize = 40;
header.biPlanes = 1;
header.biBitCount = 3 * 8;
header.biCompression = 0;
header.biXPelsPerMeter = 0;
header.biYPelsPerMeter = 0;
header.biClrUsed = 0;
header.biClrImportant = 0;
HANDLE handle = (HANDLE)::GlobalAlloc (GHND, sizeof(BITMAPINFOHEADER) + 3 * m_sizes.cx * m_sizes.cy);
if (handle != NULL)
{
char *pData = (char *)::GlobalLock((HGLOBAL)handle);
memcpy(pData, &header, sizeof(BITMAPINFOHEADER));
memcpy(pData + sizeof(BITMAPINFOHEADER), m_pPixelData, 3 * m_sizes.cx * m_sizes.cy);
::GlobalUnlock((HGLOBAL)handle);
OpenClipboard();
EmptyClipboard();
SetClipboardData(CF_DIB ,handle);
CloseClipboard();
}
Note that this is a code extract from an app which exports an OpenGL image to clipboard. It gives the general principles you need to follow.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
thank you.it's cool
|
|
|
|
|
I am having trouble using the DDX_control() macro to access an edit control from outside a dialog bar. Whenever i run the program, i get an error message and the program crashes. Is there a way to use DDX functions with dialog bars? if not, how can i use GetDlgItem() to access the control?
-- Steve
|
|
|
|
|
Where do you get what error message? What does "crashes" mean?
Yours,
the CP AntiPsychic league
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
I get an assertion error when i try to run the function that accesses the edit control from the main window. I need to know how to use DDX_control() to access a control from another class. I have code with DDX_check(), but it doesn't work the same.
-- Steve
|
|
|
|
|
DDX methods are designed to be used with the class containing them. I wouldn't recommend using them from outside the dialogbar which (I presume) contains the control.
Add your DDX calls to the dialogbar itself, and get the mainframe to talk to access methods.
Oncew you've done that, you should find DDX_Control fairly easy to understand when you step into it under debug. Key things to check are that the CDataExchange object being passed to the DDX methods contains valid info - stepping into CWnd::UpdateData() in any dialog class should show you how it all works.
Anna
Homepage | My life in tears
"Be yourself - not what others think you should be"
- Marcia Graesch
"Anna's just a sexy-looking lesbian tart"
- A friend, trying to wind me up. It didn't work.
Trouble with resource IDs? Try the Resource ID Organiser Visual C++ Add-In
|
|
|
|
|
:(I am a chinese,my english is poor.so I am sorry.
The question is : why don't show the graph that I write this program. This program code:
#include "stdafx.h"
#include <windows.h>
#include <math.h>
#define NUM 1000
#define TWOPI (2*3.14159)
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
char szClassName[ ] = "WindowsApp";
HWND hwnd;
MSG messages;
WNDCLASSEX wincl;
wincl.hInstance = hInstance;
wincl.lpszClassName = szClassName;
wincl.lpfnWndProc = WindowProcedure;
wincl.style = CS_DBLCLKS;
wincl.cbSize = sizeof (WNDCLASSEX);
wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
wincl.lpszMenuName = NULL;
wincl.cbClsExtra = 0;
wincl.cbWndExtra = 0;
wincl.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
if (!RegisterClassEx (&wincl))
{
MessageBox(NULL,TEXT("this program required windows nt!"),
szClassName,MB_ICONERROR);
return 0;
}
hwnd = CreateWindowEx(0,szClassName,"Windows App",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, /* Windows decides the position */
CW_USEDEFAULT, /* where the window ends up on the screen */
544, /* The programs width */
375, /* and height in pixels */
HWND_DESKTOP,
NULL,
hInstance,
NULL);
ShowWindow (hwnd, nCmdShow);
UpdateWindow(hwnd);
while(GetMessage(&messages,NULL,0,0))
{
TranslateMessage(&messages);
DispatchMessage(&messages);
}
return messages.wParam;
}
LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static int cxClient,cyClient;
HDC hdc;
int i;
PAINTSTRUCT ps;
POINT apt[NUM];
switch (message)
{
case WM_SIZE:
cxClient = LOWORD(message);
cyClient = HIWORD(message);
return 0;
case WM_PAINT:
hdc = BeginPaint(hwnd,&ps);
MoveToEx(hdc,0,cyClient/2,NULL);
LineTo(hdc,cxClient,cyClient/2);
for(i=0;i
|
|
|
|
|
Every call to BeginPaint() should have a corresponding call to EndPaint(). EndPaint() must be called after you finish drawing.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
I wonder whether my compiler have error? my programwhen runs well when I rebuiled my program.
but I very think you , where are you from ?;P;P
I am like programiing
|
|
|
|
|
Your compiler will not catch that because it is what we call a logic error. There is nothing wrong with your compiler. And I am from Albania by the way.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
ok how do i make a net send program in C++ 6.0, i already know the SYSTEM("net send USER MESSAGE") part, but i want to be able to make USER and MESSAGE variables, where USER would be the name or the place where i would send the message to and MESSAGE would be the message of what was to be sent...YOU CANT DO THIS THE WAY I AM TRYING, an error pops up saying something like USER can not be found on network. also i put in my user name and MESSAGE and the message sent was "MESSAGE", so u cant make a variable for that piece and use it for a large block of message.....please someone help me with this....
here is program i made which doesnt work...
#include <stdlib.h>
#include <iomanip.h>
#include <iostream.h>
int main()
{
char user[20], message[50];
cout << "USER = ";
cin >> user;
cout << "MESSAGE = ";
cin >> message;
system("net send user message");
return 0;
}
//OUTPUT
USER = boycecarter
MESSAGE = hi
An error occurred while sending a message to 'USER'.
The message alias could not be found on the network.
More help is available by typing NET HELPMSG 2273.
Press any key to continue
what do i do???
|
|
|
|
|