|
Take a look at CreateProcess() in your docs.
cheers,
-Ben
|
|
|
|
|
eheheh!!
I don't think that's right, because in this case ... try it:
#include "stdio.h"
template < class type > int size(){return sizeof(type);};
int main(int argc, char* argv[])
{
printf("%i\n",size <float>());
printf("%i\n",size <int>());
printf("%i\n",size <double>());
printf("%i\n",size <char>());
printf("%i\n",size <short>());
};
Why???
Gianfranco Lanzetta.
|
|
|
|
|
Works fine for me with VC7.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Tim Smith wrote:
Works fine for me with VC7.
Tim,
I think he can compile it and run it, but that he is not fully satisfied with the outputs he got.
Nish
The rumours that I am an AI bot are absolutely false. These rumours have been propogated by *them* to focus all the attention on to me, while *their* bots take over the planet. Thank y%%%% Divide by zero. Cannot proceed. Abort(y/y)?
|
|
|
|
|
What is wrong with the output. I got all the numbers I expected.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Tim Smith wrote:
What is wrong with the output. I got all the numbers I expected.
I believe his expectations don't match those of yours.
Nish
The rumours that I am an AI bot are absolutely false. These rumours have been propogated by *them* to focus all the attention on to me, while *their* bots take over the planet. Thank y%%%% Divide by zero. Cannot proceed. Abort(y/y)?
|
|
|
|
|
Yeah, looking at the code again, I ran into this bug with VC6. Fixed in VC7.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
|
I haven't installed any VC7 patches.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
If all you are getting is 4 or 2 for each of the types, this is a known bug I reported to MS with template functions that don't have unique types in the arguments.
This bug is fixed in VC7. Don't hold your breath for a patch to VC6.
The workaround is to use structs and not functions.
template <class _T>
struct sizer
{
int sizer () { return sizeof (_T); }
};
printf ("%d", sizer<int>::sizer ());
I think that will do it, but I didn't test it.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Some Window Engine in this page is very good (use API function: WindowFromPoint()) . But I can't use it for my purpose:
-Get handle of a "static " (label) created in Visual Basic 6.0.
It seems VB label is drawn onto screen, not be a control (so you can't get its handle).
Can you give me an answer ?
Hung Son
A Vietnamese student
i-g.hypermart.net
dlhson2001@yahoo.com
|
|
|
|
|
dlhson wrote:
It seems VB label is drawn onto screen, not be a control
I think the VB label is a STATIC control. I might be wrong here. But that's my impression.
Nish
The rumours that I am an AI bot are absolutely false. These rumours have been propogated by *them* to focus all the attention on to me, while *their* bots take over the planet. Thank y%%%% Divide by zero. Cannot proceed. Abort(y/y)?
|
|
|
|
|
You are correct, the VB label is not a control. The form draws it. My guess this is to reduce the number of controls that VB programmers place on a form, since you are only allowed to have 255 declared in a resource file.
What purposes do you want to have the handle to the label in VB? Depending on what you plan on doing, there are options.
Checkout my Guide to Win32 Paint for Intermediates
|
|
|
|
|
control.hwnd
Best Regards
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
I'm sorry I thinked that you was talking about VB...
If you want to Know the HWND of the label, you must to use the label like a CWnd, and asign it with CWnd::GetDlgItem. You can get the handle with the data memeber CWnd::m_hWnd...;)
Best Regards...
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
I've been tinkering a little with STL after my brief run-in with the map template the other week. It took me a while to recover from that episode; but i've been having a go with the string thing.
My current program users c strings (char arrays, not that mfc bunk). I can already hear Christian muttering in the background. I used them becuase my program has the following traits:
-> lots of scanf and sprintf type stuff goes on, to jam integers to and from strings.
-> I'm using sockets and use char pointers to muck about with the input buffer that i receive through my socket.
-> one part of my program decodes a mime- formatted email body. as you may know, this is a hierarchical structure where a section consists of a header and a body. a body could also be a section in it's own right, consisting of a header and a body. Right now, i start with one big char pointer, and i call a function recursively on each body section to decode. This makes extensive use of tricking a c-type string into multiple separate strings by sticking \0 in the correct places.
I'm worried that reimplementing my program using stl is going to be a nightmare. Can someone please explain to me how it will in fact be a delightful process instead.
Jon
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
I have done a lot of the same stuff that you are doing, and I started to change my program from char pointers to std::string
Performance was, err.., one third, and it was a nightmare to change the program. std::string is way too slow for extensive string-stuff
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
I have to agree with Anders. For dynamic string intensive stuff, char arrays work best. For general string storage and lightweight processing, std::string is the way to go.
I use both extensively.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
One minor clarification.
If your string intensive stuff just results in always having to reallocate storage space to support changes in the string, then std::string should work just fine too.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
I read an article in CUJ or DDJ (can't remember which) last fall which dealt with these performance problems.
One solution (using storage trade-offs) was to create a std::string compatible class called something like fixed_string. fixed_string would then implement the string using a fixed length char array. You got the best of both worlds: speed and the nice std::string interface.
The article also mentioned how you could pool these strings to optimize the performance even more (mostly for threaded environments).
I'm sorry I can't give you a correct reference to the article, my magazines are at home, and I'm not online at home anymore
Sonorked as well: 100.13197 jorgen
FreeBSD is sexy.
|
|
|
|
|
Exactly. Get the safe deallocation (if your strings are that big). Maybe even buffer overrun if you so decide it is needed.
As I have always said, know what tools are available and understand the costs involved with each.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Hi,
You should also consider the use of std::vector<char>
To the best of my knowledge, the std requires that elements should be allocated contiguosly (not sure)
Consider
std::vector<char> buffer;
buffer.resize(n);
legacy_function(&(buffer.at(0)),buffer.size());
Comments:
I am not comparing anything. Just another "tool/way" to do things that is worth be aware of
Regards,
R.
|
|
|
|
|
To the best of my knowledge, the std requires that elements should be allocated contiguosly (not sure)
The standard does not guarantee this, but later on this was perceived as a defect in the standard itself and a so called "tecnhical corrigendum" was issued in 2000 that fixes the error. Moreover, every compiler known so far stores vectors contiguously (and future ones are compelled to follow the corrigendum as well as the standard). So the moral is: contiguous vectors are a standard guarantee as of today, and every compiler implement them this way.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
corrigendum
Damn, had to look that one up.
Either...
1. I am stupid
2. Or in the US we use a different term. I guess I have always called them "errata"
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Standardese has its lingo, I guess. I find the word somewhat funny, too.
PS. If you allow me to go pedantic, for those of you with a leaning towards Latin, erratum (pl. errata) means "error", while corrigendum means something like "to be corrected" (pretty much the same, anyway.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|