|
Try this. It works.
CString prefix = "pf";<br />
int numDigit = 6;<br />
int startNum = 1;<br />
<br />
CString k;<br />
k.Format("%0*d",numDigit-prefix.GetLength(),startNum);<br />
k = prefix + k;<br />
cout << (LPCTSTR) k;
|
|
|
|
|
Saving one line
CString prefix = "pf";
int numDigit = 6;
int startNum = 1;
CString k;
k.Format("%s%0*d",prefix,numDigit-prefix.GetLength(),startNum);
cout << (LPCTSTR) k;
Ivan Cachicatari
www.latindevelopers.com
|
|
|
|
|
|
Im trying to load a bitmap into a picture box on a dialog in MFC
can any body give me a simple example
Donald
|
|
|
|
|
Hello,
Does anyone know how to copy the action of the Open With... dialog option when you right click on a file in Windows Explorer?
That is, when I right click on one of my files, for example 'msg.1', Windows Explorer presents me with a dialog to choose which application I would like to open the file with.
I would like to use this action in one of my applications, but don't know how to go about it.
Any help would be greatly appreciated.
Thanks,
Murrah Boswell
|
|
|
|
|
Take a look at ShellExecute(...)
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
Hello,
In my CList ctrl, my double click handler uses ShellExecute, i.e.;
<snip>
ShellExecute(GetSafeHwnd(), NULL, GetListFilename(nIndex), NULL, NULL, SW_SHOW);
<snip>
and it works for 'known' file types, but it doesn't give me an 'Open With...' type dialog for file types that Windows Explorer doesn't know about.
Have I missed something?
Murrah Boswell
|
|
|
|
|
otrcomm wrote:
Have I missed something?
No I did, sorry. I just assumed that for unknown types it would display the dialog for you. You know what they say about assumptions right?
So after some digging here is what I found:
ShellExecute will return SE_ERR_NOASSOC for a file extension with no association. So under that condition you do this:
HINSTANCE hInst =
::ShellExecute(NULL, "open", "rundll32", "shell32.dll,OpenAs_RunDLL c:\\winzip.log", NULL, SW_NORMAL);
The example of course is where you tried to open the file [C:\\winzip.log]
Hope that helps
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
That did it!
Thanks man!
When I get the project finished that I am working on, I'll send you the code if you want it. It's a very fast search engine for files and 'text in files' for Windows. And if I get it together, I will also have it search a Win32 Squid Cache.
I already have the Squid Cache search engine working in a Unix environment (written in Perl), but now I want to get it working in the Windows environment.
Murrah Boswell
|
|
|
|
|
Sounds like good material for a CodeProject Article eh?
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
Yeah, that's where I'll post it!
I've never posted anything at CodeProject, but I guess it's high time!
Murrah
|
|
|
|
|
I have a memory blank ...
what's the name of the MFC shape drawing sample program ? where you can draw shapes (squares, circles, ... ) , select them, manipulate them, ...
I know about scribble, but it's not the one I want... ( or I have the wrong version ).
I need it to use as a prototype template.
Thanks.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
|
yes, I think that's the name, will check tomorrow .. .
Thanks!
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
ok,thing is quite simple.Why cant i manage to compile a damn program with the ms c++ 6.0???
If anybody anywhere can spare a few moments to either tell me a site with the biggest 'tutorial for
complete idiots' or just write a simple step by step
for me i'd be .....grateful.All i want is to make an executable file so dont bother with the type of wizards i want to use,just basic 'do this then do that'.thanks.
|
|
|
|
|
|
Hi.
I have an application where I use WaitForMultipleObjects()
to wait for any one ( ie) 'any of' not all ), of a number of events to become signalled. However, the maximum number of events that I can wait on in a single call to WaitForMultipleObjects is 64. I need to be able to wait on more than 64.
I know that I could create groups of 64 and loop through them with a timeout until I get one of the events signalled. But, I cannot afford the time waiting for a
timeout to occur, however small.
If anyone has an idea of how I could get around this I would appreciate the help.
James.
|
|
|
|
|
Would it be possible to have multiple threads waiting? Each thread would wait for no more than 64 events.
|
|
|
|
|
Thank you for the reply.
I had thought of that, but again I did not want to compromise the throughput speed that the application currently delivers.
But, I have been thinking about this all night and I cannot think of another solution that would 'scale' as well as your suggestion.
So, it looks like thats the road I will have to take.
Best regards.
And again, thank you for the reply.
James.
|
|
|
|
|
After much deliberation and study of my code, I have decided to abandon the idea of trying to handle more than 64 events.
It is just not possible to integrate multiple threads, each waiting on a set of 64 events.
I need to be able to maintain the current application throughput and the overhead would be too much.
The list of events that I wait on is not constant and is waited on upto 3000 times per second.
The intended user will just have to deal with the limitation.
So thats that.
|
|
|
|
|
Hi,
I have a question if there is a limitation on the number of timers that could run on a Dialog.
SetTimer method of the CWnd class is used.
|
|
|
|
|
Hi,
AFAIK (As Far As I Know) there is only a limitation within Windoze, they say there is a maximum of timer handles Windoze can handle (how poetic), but I've never heard of a limit within a dialog..?
hope it helps...
---
YOU KNOW WHAT YOU ARE BLONDIE!?!? YOU'RE JUST A SON OF A BA A A A AAAAAAAAAA!!!!!
http://sprdsoft.cmar-net.org
http://t1tan.cjb.net
|
|
|
|
|
ok let me reframe the question to how many timer handles Windoze can handle given the fact that all the "OnTimer" processing happens on a single UI thread
|
|
|
|
|
|
I see the following behavior under VC6:
template <class T> void foo()
{
printf("sizeof(..)=%i\n", sizeof(T));
}
int main(int argc, char * argv[])
{
foo<BYTE>();
foo<float>();
return 0;
}
(the real implementation is a bit more complex, it's a bit more complex, seems like at (*) VC6 chooses to call the float variant)
However, when I change the function declaration to
template <class T> void foo(T * p = NULL)
{
printf("sizeof(..)=%i\n", sizeof(T));
}
it seems to work correctly.
I know that you can't templatize functions by values, only by types - btu that the types must appear in the argument list??!!
Is this (yet another template-related) bug of VC6, or is this what the C++ Standard says?
(I'm pretty much pissed anyway, checking a few dozen templates if they need the T*=NULL trick, but I'd like to know at least if it's my ignorance or the compiler's fault)
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist || Agile Programming | doxygen
|
|
|
|