|
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
|
|
|
|
|
ok i added those libraries ... also i added "stdafx.h" but got this error when compiling...
--------------------Configuration: netsent - Win32 Debug--------------------
Compiling...
netsent.cpp
c:\documents and settings\carter\my documents\c++ files\netsent.cpp(1) : fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directory
Error executing cl.exe.
netsent.exe - 1 error(s), 0 warning(s)
here is my source..
#include "stdafx.h"
#include <windows.h>
#include <iostream.h>
#include <conio.h>
#include <stdlib.h>
int main()
{
char user[20], message[1000];
char szFullMessage[256] = {0};
cout << "User/IP = ";
cin >> user;
cout << "Message = ";
cin >> message;
sprintf(szFullMessage, "net send %s %s", user, message );
system(szFullMessage);
return 0;
}
|
|
|
|
|
do anyone know the how to write code for rotating & mirror objects drawn in mfc? instead of drawing them again and again for each rotation.
e.x.
OnDraw()
{
//shape 1
draw the shape 1
//shape2
draw shape 2
//shape3
draw shape3
}
rotate()
{
//rotate shape 1, 45o degrees
//again rotate shape 1
//again rotate shape 1 etc...
}
Is there a code that do this rotating?(example-CRect, which draw the rectangle) something similar to this..
even if not just let me know...
thanks
shanila
|
|
|
|
|
How to add bar containing icons for commonly-used folders, such as My Computer, Favorites and Desktop in my CFileDialog?
|
|
|
|
|
hi
I don't know how to set icons in CFileDialog.But you can do this using Microsoft Common Dialog controls.
1. Go to Project-->Add to Project-->Components and Control.
2. Choose Registered Activex Controls and select Microsoft Common Dialog Control Version 6.0.
3. Insert this component.(The control will now appear in your tool box.)
4. Place the control in your dialog.
5. Add a member variable for this control.
6. Call the ShowOpen() method.
I hope it's OK for you
Mahesh Varma
|
|
|
|
|
|
hi, i'm looking for a routine to convert double to string with at least a precision as the windows calculator does(32 digits after the comma)!
does someone know such a function??
thx 4 help,
IceMatrix
|
|
|
|
|
try this:
double dFoo = 41.1325934653849974801841984193481498319048193849
char string[256];
sprintf("%d.32", dFoo);
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
small correction of last line
<br />
sprintf(string,"%f", dFoo);<br />
|
|
|
|
|
|
Anna-Jayne Metcalfe wrote:
If you need more than that, you're going to have to roll your own.
I didn't think you smoked
The tigress is here
|
|
|
|