|
toxcct wrote: in the mainframe's oncreate(), isn't the window not created yet ?
Yes, it is, but AfxGetMainWnd may return NULL as the m_pMainWnd has not been set yet.
|
|
|
|
|
Hi,
I got it when i added have added negation the caption style in the precreatewindow function and added the above code in the on create function.
Thanks both for ur help.
Radhika.
|
|
|
|
|
Hi all,
i am working on a simulink model (graphical block programming) and in a block i am supposed to write a user defined function (S-Function) which takes a double value and outputs 8 uint8 values. It has some simulink related commands but basically C Code. Since i have an error message, i would like to share it with you all to find a way out.
#define S_FUNCTION_NAME double2integer
#define S_FUNCTION_LEVEL 2
#include "simstruc.h"
typedef union
{ uint8_T uvalue[8];
real_T d; //real_T is double
} UnionNum;
static void mdlInitializeSizes(SimStruct *S)
{
ssSetNumSFcnParams(S, 0);
if (ssGetNumSFcnParams(S) != ssGetSFcnParamsCount(S)) {
return; /* Parameter mismatch will be reported by Simulink */
}
if (!ssSetNumInputPorts(S, 1)) return;
ssSetInputPortWidth(S, 0, 1);
ssSetInputPortDataType(S, 0, SS_DOUBLE);
ssSetInputPortDirectFeedThrough(S, 0, 1);
if (!ssSetNumOutputPorts(S,1)) return;
ssSetOutputPortWidth(S, 0, 8);
ssSetOutputPortDataType(S, 0, SS_UINT8);
ssSetNumSampleTimes(S, 1);
ssSetOptions(S,0);
}
static void mdlOutputs(SimStruct *S, int_T tid)
{
int_T i;
int_T width = ssGetOutputPortWidth(S,0);
InputPtrsType uPtrs = ssGetInputPortSignalPtrs(S,0);
uint8_T *y = (uint8_T *)ssGetOutputPortSignal(S,0);
UnionNum num;
num.d = *uPtrs[0] ;
for(i=0; i
|
|
|
|
|
cahit23 wrote: Error : Have illegal types 'double' and 'void'
Do you not think it pertinent to include the line number of the code this error refers to? We're not mind readers.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: Do you not think it pertinent to include the line number of the code this error refers to? We're not mind readers.
Oh sorry, pointed lines are :
real_T d; and
** real_T is the representation of double in this format, even if i write there 'double' appears again as error **
num.d = *uPtrs[0];
Thank you for your consideration!
Cahit
|
|
|
|
|
cahit23 wrote: How split up a double value into 8 sets of uint8
use this :
union DoubleToBytes {
double _d;
uint8 _ui[8];
};
|
|
|
|
|
Hello!
my problème is when I pick the date from a day Time picker, i have for
example 9 but I want to have 09 (2digits) because i need it in this format
can you help me
thanks a lot!
|
|
|
|
|
zizzzz wrote: because i need it in this format
Use CString::Format(...); // This is if you want to use Strings. It's a bit
// lengthy procedure
CDateTimeCtrl::SetFormat(...)
-- modified at 9:58 Monday 18th September, 2006
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
zizzzz wrote: ...a day Time picker...
What's this?
zizzzz wrote: i have for
example 9
9 what? September? Ninth day of the month?
zizzzz wrote: I want to have 09 (2digits) because i need it in this format
So how are you currently extracting the date from the control?
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
yes it is exactly that 9--->september
|
|
|
|
|
zizzzz wrote: I want to have 09 (2digits) because i need it in this format
can you help me
you should read format specifier
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi all,
OK, so lets say you have an application, lets call it app1. app1 may not have more than one process running at one time. And if another process was found restore the previous app1. This is where the problem comes in.
See the thing is the the second instance of app1 has been opened and the app sees that another instance is running (of itself), how will it diffrenciate between the two app window names, to bring the correct one to the foreground??
Really Hope this makes sense
Any ideas???
Thanx in advance
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
actually, it does use a semaphore/mutex, which name must be unique.
see this[^] class to understand what it actaully does.
|
|
|
|
|
Programm3r wrote: app sees that another instance is running (of itself)
So do you want to keep the second instance also running?
Or kill the second instance and bring the focus on the first instance that was already running?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Thanx for the reply...
"....Or kill the second instance and bring the focus on the first instance that was already running? ...."
Yes, I want to send a return code to the calling app (2nd opened application) so that it will see that another instance is already running, kill itself and cause the 1st instance to restore it's window.
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
There could be various solutions to this problem.
Preferrably using mutex's .
something like
HANDLE hMutex;
hMutex = CreateMutex(
NULL, // no security attributes
FALSE, // initially not owned
"SomeUniqueName"); // name of mutex
If this exists already return from the application.
Another option would be to use a shared variable and check for its value. Increment it each time an instance is created. If the value is greater than one you can just return from the second instance.
The third option would be to use the FindWindow function. You would get the handle to the window if it's already running.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
|
Thanks buddy. Will try and go through this article tomorrow.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Thanx for the help... I'll try it
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
I am using VC++6.0 and trying to run a demo project about the dialog resources using from <<windows programming="">>.
I copyed its .cpp file, resource.h file into my project, and pasted its .rc file into my .rc file using notepad and add into the project also. But it didn't work,and pop out these errors:
--------------------Configuration: mymenu - Win32 Debug--------------------
Compiling...
mymenu.cpp
E:\work\project\mymenu\mymenu.cpp(20) : error C2065: 'IDC_BLACK' : undeclared identifier
E:\work\project\mymenu\mymenu.cpp(22) : error C2065: 'IDC_RECT' : undeclared identifier
E:\work\project\mymenu\mymenu.cpp(195) : error C2065: 'IDM_APP_ABOUT' : undeclared identifier
E:\work\project\mymenu\mymenu.cpp(195) : error C2051: case expression not constant
E:\work\project\mymenu\mymenu.cpp(203) : warning C4060: switch statement contains no 'case' or 'default' labels
E:\work\project\mymenu\mymenu.cpp(257) : error C2065: 'IDC_WHITE' : undeclared identifier
E:\work\project\mymenu\mymenu.cpp(259) : error C2065: 'IDC_ELLIPSE' : undeclared identifier
E:\work\project\mymenu\mymenu.cpp(263) : error C2065: 'IDC_PAINT' : undeclared identifier
E:\work\project\mymenu\mymenu.cpp(299) : error C2051: case expression not constant
E:\work\project\mymenu\mymenu.cpp(301) : error C2065: 'IDC_RED' : undeclared identifier
E:\work\project\mymenu\mymenu.cpp(301) : error C2051: case expression not constant
E:\work\project\mymenu\mymenu.cpp(303) : error C2065: 'IDC_GREEN' : undeclared identifier
E:\work\project\mymenu\mymenu.cpp(303) : error C2051: case expression not constant
E:\work\project\mymenu\mymenu.cpp(305) : error C2065: 'IDC_YELLOW' : undeclared identifier
E:\work\project\mymenu\mymenu.cpp(305) : error C2051: case expression not constant
E:\work\project\mymenu\mymenu.cpp(307) : error C2065: 'IDC_BLUE' : undeclared identifier
E:\work\project\mymenu\mymenu.cpp(307) : error C2051: case expression not constant
E:\work\project\mymenu\mymenu.cpp(309) : error C2065: 'IDC_MAGENTA' : undeclared identifier
E:\work\project\mymenu\mymenu.cpp(309) : error C2051: case expression not constant
E:\work\project\mymenu\mymenu.cpp(311) : error C2065: 'IDC_CYAN' : undeclared identifier
E:\work\project\mymenu\mymenu.cpp(311) : error C2051: case expression not constant
E:\work\project\mymenu\mymenu.cpp(313) : error C2051: case expression not constant
E:\work\project\mymenu\mymenu.cpp(325) : error C2051: case expression not constant
E:\work\project\mymenu\mymenu.cpp(327) : error C2051: case expression not constant
Error executing cl.exe.
mymenu.exe - 23 error(s), 1 warning(s)
|
|
|
|
|
"undeclared identifier" it seems you need to include a header file to mymenu.cpp did you include this file?
|
|
|
|
|
yes, as you can see in .cpp file, I had
#include <windows.h>
#include "resource.h"
|
|
|
|
|
check the Ignore HTML tags in this message (good for code snippets) check box
|
|
|
|
|
sure you include but i cant see header file in previous your thread i saw only #include:) anyway these erros are only a thing a include
|
|
|
|
|
Hello everybody,
I've figured out that windows supplies an smart way to draw cutom elements via DrawFrameControl.
When drawing a radio button or a checkbox the question is where to place the text exactly. Of course it is no problem to figure out the settings for the standard settings (MS Sans Serif 8), but I wonder the windows internal logic for other fonts and sizes. I've used a lot of time to consider all values of GetTextMetrics, but I was not success full.
Has anybody found a rule where the text is placed exactly depending on font and font size?
|
|
|
|