|
Generally, it is better to uses std::string class instead of using raw pointers. Far more easier to uses and less error-prone.
And for the rest, many people have already answer the question.
Philippe Mori
|
|
|
|
|
Even though MS is the most resourceful software comapny in the world and hires the most accadmecally qualified and supposedly the most intelligent developerers, it does not produce innovative ,imaginative or quality software on a consistant basis. Instesd it produces buggy software tested on it's smug users through a a number of versions. Not that MS software isn't good or the company is evil, but with its awesome financial resources, though the company could do better,it doesnt. Why?
|
|
|
|
|
troll-1 wrote:
Why?
Because they didn't hire you? Anyway, VC board isn't a place to ask this kind of question. Go to lounge or soapbox instead.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
Hello,
I'm here to ask what message is sent when the dialog bar is moved to a position where it can be docked, because I want to change its appearance and size depending on the side it gonna be docked.
thanks,
Guy.
|
|
|
|
|
Hi,
i want to write two programs, which are able to switch to the other program (if they are running). Both programs have a button. If you press this button:
1. The other program is launching if it is not running.
2. If the other program is running (multiple instance possible), the window of one of these instances should be pop to the front of the desktop.
Has anybody an idea?
Ciao
f.o.b
|
|
|
|
|
The most important thing is to get a handle to teh window in the other application. You can do this with GetWindow. You may have to do some searching through all of the windows, but you will be able to find the window in the other app with this API.
Next you can call SetForegroundWindow on that window handle. This will bring that window to teh foreground and give it keyborad access.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Do a search for AttachThreadInput in here over the last weeks or so.
There are issues with SetForegroundWindow that must be worked around
for your plan to succeed. (unless you still run Win95 )
|
|
|
|
|
I want to get the keyvalue out:
void DLLGetValue(int imageIndex,CString key,char* keyvalue)
{
if (imageIndex == 0)
{
if (key=="abc") value="aa";
if(key=="def")value = "ss";
if (key == "aaa")value = "dd";
}
strcpy(keyvalue, value);
}
and its called like:
std::set<cstring>::iterator it = pDoc->m_keySet.begin();
for (; it != pDoc->m_keySet.end()
{
char* p = new char[2]; p[0] = p[1] = '\0';
int size=30;
if (size)
{
delete[] p;
p = new char[size + 1];
DLLGetValue(imageIndex,*it,p);
}
When p comes back, its full of garbage. WHat did I do wrong?
Thanks,
ns
|
|
|
|
|
From the top of my head - you should have at least three character buffer for "aa", "ss" or "dd" - don't forget about trailing null character. However, why on Earth would one mix these manual, low-level, stinky character operations with STL? Can't you just use string& as keyvalue?
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
Thanks. You are quite right about CString being a better choice, but I'm simulating a DLL that pre-exists and returns a char *, so I had to venture into the not-so-friendly world of char. Eventaully it replaces my fake function.
Thanks again,
ns
|
|
|
|
|
OOps,I meant it didnt run at all, didnt compile errors were like:
C:\Trainer\Train\Train1\Train1View.cpp(796) : error C2440: '=' : cannot convert from 'char [7]' to 'int'
which didnt clue me in to the fact that I had not declared "value" . I'm sure that error was there too, but I didnt see it buried in all the compiler warnings for STL.
It works now.
Thanks,
ns
|
|
|
|
|
(I know I'm not answering your question, but...) You should bracket your code within <pre> and </pre> tags in order to preserve the indentation so that it's easy to read. The new formatting buttons that Chris introduced makes it easy to do this.
Thanks,
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
ns wrote:
I'm sure that error was there too, but I didnt see it buried in all the compiler warnings for STL.
You can get rid of those warnings with a pragma.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
|
I want to integrate a version for my DLL... How to do that???
Thanks in advances
Hello World!!!
from Raphaël
|
|
|
|
|
Add a resource script (.rc) file to the project, then select the "Resources" tab within VC++ and add a version resource.
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I was the beginner of the learner c language now meet some proble instead donot how to apply the colour source in my program so hope can u help me? The project that want to apply in the background text and text that hv the colour.
Thank you.
|
|
|
|
|
I'm sorry, but I can't understand what you're trying to ask
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
i want ask how to apply the colour in the c language program while we execute the program that colour will appear at the MS-DOS Prompt
|
|
|
|
|
i need the colour source code and that function how to use i hv try before that with using the #include <graphics.h> to apply the color for my text and text background color but cannot work
|
|
|
|
|
|
My current code is this
AddPrinterDialog::AddPrinterDialog()
{
try
{
mAddPrinterDialogPointer = new AddPrinterDialog;
}
catch(...)
{
PostMessage( WM_QUIT, 0, 0 );
}
}
BUT what happens if I have an overloaded constructor that initialises data members during construction? My try block won't work will it, as I am using 'new' to implicitly call the default constructor.
How could I change my code so I can construct an object with all data members initialised to ArgumentA that is passed in?
Daniel
Obseve everything, remember more...
|
|
|
|
|
I'm not sure what you're after now. Can't you just use right constructor with new?
m_addPrinterDialogPtr = new AddPrinterDialog("doopa", "zoopa", "koopa", NULL, 3.14);
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
I've just found that the following puts the aplication into an assertion loop.
AddPrinterDialog::AddPrinterDialog()<br />
{<br />
try<br />
{<br />
mAddPrinterDialogPointer = new AddPrinterDialog;<br />
}<br />
catch(...)<br />
{<br />
<br />
}<br />
<br />
}
All I want is some code that has a constructor throwing an exception if it fails. It seems I can't use the current code.
That webpage was interesting, but the code was v.confusing. For example
<br />
C::C()<br />
try<br />
: A ( )
, b_( )<br />
{<br />
}<br />
catch( ... )<br />
{<br />
<br />
}<br />
<br />
is all very well but what if you're NOT inheriting? Or you don't care about parent classes (say you derived from an MFC class).
All I want is a default constructor throwing an exception. But I have no idea how you test for an object's existence, especially inside the default constructor's body as the object won't have been created yet.
Obseve everything, remember more...
|
|
|
|
|
First of all, you have infinite recursion in your construction - I didn't spot this in original post. Why are you keeping pointer to AddPrinterDlg inside AddPrinterDlg?
Second: as the article I've pointed you to said, object doesn't live (and, in fact, have never been born) when exception was thrown during construction. If you expect exceptions coming out of constructor, you should create your object in try/catch block.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|