|
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???
|
|
|
|
|
user and message are constants in your program. You are saying that the user name will be "user" and the message will be "message". Change the whole string to a variable, then try.
|
|
|
|
|
How about, instead of calling "system" like you are doing so now, doing something like this:
char szFullMessage[256] = {0};
sprintf( szFullMessage, "net send %s %s", user, message );
system( szFullMessage );
Another solution if you want to make a direct function call (much faster), is to call NetMessageBufferSend.
Chris Richardson Terrain Software
|
|
|
|
|
Also you can write:
CString user, message;
CString command;
command.Format("net send %s %s", user.GetBuffer(0), message.GetBuffer(0));
system(command.GetBuffer(0));
A. Riazi
|
|
|
|
|
ok im only in CS 1 now...and i have pretty n00b like skills compared to u guys...so here----i dont know what "%s" is or what CString user, message is or what command.Format is etc etc etc....my knowledge is prety limited when it comes to what u all are talking about...please let me know what u are doing as u are doing it so i understand it....thanks. and also, i want to make clear that i want USER to be a char variable that someone enters in, and i want MESSAGE to be another char variable that will be the message sent....
ex.
"USER = " cin >> BoyceCarter //my comp address
"Message = " cin >> HEY WHATS UP //also how can u make a message to hold more than just one word.... cause i've tried to do that with my simple net send command ("net send BoyceCarter HI YOU") and all that comes back is HI...not the whole HI YOU part...etc thanks so much
~carter
|
|
|
|
|
Carter
Okay in simple terms
%s is a place holder for whatever you want in it. For example:
line 1. char somestring[] = "really cool";
line 2. sprintf("This is %s", somestring);
The variable somestring (in line 1)is holding the string "really cool".
Line two just replaces the %s with whatever is in the variable.
The go in order. So if you had
sprintf("This is %s and I %s", somestring, anotherstring);
Okay CString. Basically CString is a class that provides support for manipulating strings.
According to MSDN: It is intended to replace and extend the functionality normally provided by the C run-time library string package.
One of the extended functions is the format function. CString is the base class and format is a finction under that class. format allows you to basically setup a string just like using sprintf, where you can use %s or other format variables.
Now I know the other programming guru's out there will complain that I totally did not follow prgramming speaking edict...but how cares just as long as you understand what's going on. I too hate it when these guys speak over my head and I try to keep it at my or some other programmers level so that theres an understanding.
Hope this helps
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
ok THANK YOU SO MUCH Tom, but i have only one more prob...how do u declair the sprintf("... i am getign this error..
--------------------Configuration: netsent - Win32 Debug--------------------
Compiling...
netsent.cpp
C:\Documents and Settings\Carter\My Documents\C++ Files\netsent.cpp(16) : error C2065: 'sprintf' : undeclared identifier
Error executing cl.exe.
netsent.exe - 1 error(s), 0 warning(s)
----------------------------------------------------------------------------
thanks..
~carter
|
|
|
|
|
Add following files to your stdafx.h:
#include <stdlib.h>
#include <conio.h>
A. Riazi
|
|
|
|