|
Hello,
I'm writing an applicaion and I'd like to display nice pictures instead of usual text tabs. Is there a way to do that simply ?
Thanks,
Allad
----
Navigator - Your best alternative to Windows Explorer
|
|
|
|
|
You have to owner draw the tabs.
Owner drawn
Jesus Loves
|
|
|
|
|
Thanks replying.
But I don't know how to owner draw property sheet tabs.
I'm using CPropertySheet MFC Class. Can you help me?
Cheers,
Allad
----
Navigator - Your best alternative to Windows Explorer
|
|
|
|
|
Hi all:
When I am writing programs, I always have the problem that the compiler complains that a variable is already defined in some files. I need some global variables to be used in several files, is there any good way to avoid this kind of problems please???
Thanks in advance!!!
Asura
|
|
|
|
|
A classic problem. Follow this patten.
Declare the global in a .H file.
extern int g_MyGlobal;
And define it in a .C or .CPP file:
int g_MyGlobal;
Now include the .H file anywhere you need to access the global.
Steve
|
|
|
|
|
Hi all:
I am going to build a particle system which the system contains a set of particles where every particle is a struct contains some other arrays. The code is like following:
typedef struct{
float m; /* mass */
float c; /* charge */
float *x; /* position vector */
float *v; /* velocity vector */
float *f; /* force accumulator */
std::set<int> neigh; /* neighbour index array */
} *Particle;
typedef struct{
Particle *p; /* array of pointers to particles */
int n; /* number of particles */
float t; /* simulation clock */
} *ParticleSystem;
When I use this, do I need to allocate memory for every float array in every particle??? Or should I just add new elements to the arrays without explicitly declare the array sizes???
Thanks in advance!!!
Asura
|
|
|
|
|
So the x , y and f members are vectors (in the mathematical sense)? If that is the case I'd use something like this:
struct Vector
{
double x;
double j;
double z;
};
struct Particle
{
double m;
double c;
Vector x;
Vector v;
Vector f;
std::set neigh;
};
typedef Particle *PParticle;
I have made some changes:
- I hate K&R style brace placement.
- As a rule of thumb use double.
Steve
|
|
|
|
|
yeah, it's vector I wanted, it's really a good solution, thanks alot.
Asura
|
|
|
|
|
This code:
CString foostr ("This is a string.");
cout << foostr << endl;
produces this output:
0035C3B8
What's going on?
|
|
|
|
|
My guess would be that you are displaying the address (in hex) of the buffer that holds the string data.
|
|
|
|
|
In addition to Graham Bradshaw's response^.
Cast your CString object to a string pointer, and the string output will show up as expected::
<br />
cout<< (LPCTSTR)foostr << endl;<br />
I Dream of Absolute Zero
|
|
|
|
|
maybe CString does not have a << operator ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
hi,
I have simple WinApp program. it has a dialog nemu. I add a text edit box in the dialog menu. I also use the ClassWizard to associate a event EN_CHANGE to this function:
void CSATAGPSTeleTrackDlg::OnChangeEdit2()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
}
But each time, when I place a cursor into the text edit box and hit "ENTER" key, the program is exit or terminated on it own....but i don't want it happens like that. I want it to indicate that I have just entered my input, and take the input from the box, and process it and goes on...
I am sure I miss something to handle the text edit box correctly, can anyone help or point me to the right direction?
thank you
Jim
Jim
|
|
|
|
|
Whenever the return key is hit on a dialog Windows will by default fire a WM_COMMAND event saying that the default button was clicked (usually with the id of IDOK). To override it you'll need to watch any keyboard messages received and filter them out.
To do this override the PreTranslateMessage event for the dialog using the Class Wizard and add something like:
BOOL CYourDialogClass::PreTranslateMessage( MSG* pMsg )
{
switch( pMsg->message )
{
case WM_KEYDOWN:
{
if( pMsg->wParam == VK_RETURN )
{
if( pMsg->hwnd == GetDlgItem( IDC_EDIT1 )->GetSafeHwnd( ) )
{
return TRUE;
}
}
}
}
return CDialog::PreTranslateMessage(pMsg);
}
Gavin Taylor
w: http://www.gavspace.com
-- modified at 19:33 Monday 6th February, 2006
|
|
|
|
|
Much easier would be to give the edit control the "Want return" property, which is on the "Styles" tab of the properties. When you do that, the edit control will automatically catch enters itself and not cast them to the parent dialog box. This property is mainly valid for multiline edit controls (where you want to be able to enter newlines, without quiting your program every time)
William Engberts
|
|
|
|
|
hi there,
You guys are the best...Thank you so much...Cool! this website is golden and so heplfull in term of educational...
Again, thank to both of you...
J.
Jim
|
|
|
|
|
I'm looking for a good book to learn about Visual C++ .net
I have a moderate amount of experience with C and C++, and have used older versions of Visual Studio, but never felt completely comfortable in the environment.
Most books I've looked at concentrate too heavily on language, not enough on Visual Studio, etc for me.
Any suggestions are welcome!
-mutty
|
|
|
|
|
Are you asking for a book on C++/CLI ( that is, managed C++ ) ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
If your are specifically looking for .NET stuff (i.e. managed extensions) I have no idea. For learning visual studio and MFC I'd recommend:
-Practical Visual Studio C++ 6.0, Bates & Tompkins, ISBN 0-7897-2142-2
deals with an older version of visual studio, but it's a very good introduction
-Visual C++ .NET bible, Archer & Whitechapel, ISBN 0-7645-4837-9
mostly MFC related, but under the VS.Net enviroment. Bit in at the deep end compared to
the book above, but written for the right version of VS
Have fun!
Cheers,
Mark
|
|
|
|
|
Ok, i can easily write _T("Charge Control Valve") to make a Unicode string out of my ASCII string at compile time.
But _T("チャージコントロール") in the same source file doesn't work. I can't even write or paste it into my source file.
The only idea i have is
WCHAR myString[] = {0x1234, ... , 0x0000 };
Another question, can i avoid LoadString and get a pointer to the strings in the stringtable?
Thanks
|
|
|
|
|
Look up the definition of the _T macro
#ifdef UNICODE
#define _T(x) L##x
#else
#define _T(x) x
#endif So in a UNICODE build _T("Hi") becomes L"Hi" and in an SBCS or MBCS build it becomes "Hi" .
Try using L instead of _T .
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
Thanks for your reply, but that doesn't solve my problem.
My problem is that i want japanese strings in the source code, but the IDE and Compiler doesn't support unicode source files (VC6). I've now made a Perl Script that creates arrays or WCHAR's from the unicode string. Any better idea?
WCHAR jpn[] = {0x0032, 0x6B21, 0x30A8, 0x30A2, 0x0000};<br />
AfxMessageBox (jpn);
|
|
|
|
|
Hi,
Do I have any realistic hope of being able to diagnose a bugcheck if I have the minidump file?
I am an app developer, and I know nothing about kernel-mode. I know the error code: 0x10000050.
Is there a resource I could use to learn how to use the dump file, or would it just be a goose-chase since I am not expert at kernel-mode stuff?
Thanks,
Rich
|
|
|
|
|
Hi everyone,
I am trying to use the boost multithreading library. I am having a
problem as the join() function for the thread never returns. I am using
a boolean variable to indicate when the thread should stop running.
Here is basically a stub of what I am doing:
<br />
bool m_RunThread = false;<br />
scoped_ptr<boost::thread> myThread;<br />
<br />
void MyObject::StartThread()<br />
{<br />
m_RunThread = true;<br />
myThread.reset(new boost::thread(boost::bind<br />
(&MyObject::MyThreadFunc, this)));<br />
}<br />
<br />
void MyObject::StopThread()<br />
{<br />
m_RunThread = false;<br />
myThread.join();
<br />
... Never gets here....<br />
<br />
}<br />
<br />
void MyObject::MyThreadFunc()<br />
{<br />
while (m_RunThread)<br />
{<br />
}<br />
}<br />
However, the join() function in StopThread never returns. I think that
using a variable to synchronize this is probably not a good idea. Any
thoughts and suggestions?
Cheers,
K
|
|
|
|
|
Have you verified that MyObject::MyThreadFunc ever exits? Perhaps it's spinning in a loop.
Steve
|
|
|
|