|
RisKhan wrote: i create a window which show irregular shape draw in OnPaint
If you paint irregular shapes in OnPaint, its not meaning that you are making the window shape irregular. The window will be rectangle. To make your window irregular in shape you have create a region of the shape you wanted and use
SetWindowRgn(..)
This will slove your problem.. Hope this'll help you..
Do your Duty and Don't expect the Result
|
|
|
|
|
Hi all,
I have a string(not a CString), actually a file path. As an example,
c:\Test\MyProject\G00062_002_01.srf<code><br />
<br />
Then in following way get some data.<br />
<br />
<code><br />
string FullPath = c:\Test\MyProject\G00062_002_01.srf;<br />
string filePath = FullPath.GetFileTitle(); <br />
<br />
string groupID; <br />
string sessionId; <br />
string partID; <br />
<br />
groupID = filePath.substr(1, 5); <br />
sessionId = filePath.substr(7, 3); <br />
partID = filePath.substr(11, 2);<br />
<code><br />
<br />
<br />
So my outputs are 00062, 002, 01 respectively as string type. I want to add those values in a database as int type. How should I do this conversion.<br />
<br />
Where I'm confusing is that, outputs are in string format. But actually there are some integers.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Eranga Thennakoon wrote: string FullPath = c:\Test\MyProject\G00062_002_01.srf;
You can not write like this.
You have to write :
string FullPath = "c:\Test\MyProject\G00062_002_01.srf";
Eranga Thennakoon wrote: string filePath = FullPath.GetFileTitle();
No function like string::GetFilePath();
This is for only information.
Your Solution is this:
int x;
sscanf(groupID.c_str(), "%d", &x);
Now x will contain 62 and you can store it in Database or anywhere.
Have a nice day.
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
Manish_mnp wrote: Eranga Thennakoon wrote:
string filePath = FullPath.GetFileTitle();
No function like string::GetFilePath();
So how it gives me the required values. I don't understand this.
Thanks for your solution. I've try one thing.
int grID;<br />
stringstream stGroup(filePath.substr(1, 5));<br />
stGroup >> grID;
What you think....
I appreciate your help all the time...
Eranga
|
|
|
|
|
T've also try but its giving me error like this:
error C2079: 'stream' uses undefined class 'std::basic_stringstream<_Elem,_Traits,_Alloc>'
with
[
_Elem=char,
_Traits=std::char_traits<char>,
_Alloc=std::allocator<char>
]
error C2440: 'initializing' : cannot convert from 'std::basic_string<_Elem,_Traits,_Ax>' to 'int'
with
[
_Elem=char,
_Traits=std::char_traits<char>,
_Ax=std::allocator<char>
]
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
Are you getting it??
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
No, I don't get such error. only use string class.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Did you #include <sstream> ?
|
|
|
|
|
Ya i am getting now but its easy to use atoi or sscanf .
What you think about it?
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
|
No, only the #include <string>
I appreciate your help all the time...
Eranga
|
|
|
|
|
I would say it is much better than using the C functions (sscanf, atoi, ...) because you are consistent (you used string, so stay with the tools the stl provides you). I don't like the idea of mixing C++ (std::string) with C (atoi, sscanf, ...).
What is this thing with GetFileTitle ? std::string doesn't have such a function so it shouldn't even compile (except if you pasted a wrong piece of code).
|
|
|
|
|
Hi Cédric,
What happend for your name?
|
|
|
|
|
Yeah, I realized that too. Don't know what happen but when I update my settings, it complains that my name is too long (even if it is under the limit of 50 chars). I removed the bold tag now, let's see if that works.
|
|
|
|
|
I think its problems of upgrade for example see Default icon is changed of question to general.
|
|
|
|
|
Actually I don't get any error on that code.
And also even me don't like to mix-up C and C++
I appreciate your help all the time...
Eranga
|
|
|
|
|
You could also use boos::lexical_cast[^]
It does the gory details of the stream-woking wrapped nicely in a routine that looks like a cast.
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
Manish_mnp wrote: You can not write like this.
You have to write :
string FullPath = "c:\Test\MyProject\G00062_002_01.srf";
You can not write like this.
You have to write :
string FullPath = "c:\\Test\\MyProject\\G00062_002_01.srf";
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Yep you are right. Actually that file path not written on the application. It is find from the application and I've just use it.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Do you want to convert string values to int?
|
|
|
|
|
Yep, actually my required values are there in a string. I want add those values as int in a Database.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Did you see functions like atoi and itoa.
|
|
|
|
|
Those are from C right, not C++ functions. Is it better to mix up them. Actually I don't like to do it.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Eranga Thennakoon wrote: How should I do this conversion.
Have you considered atoi() ?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Read above, he doesn't want to mix C with C++ (BTW i don't see where the problem is)
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Hi
I am creating a MAC OS Type dock bar application (Similar to Object dock) on Windows for one of our customer. I need to implement auto hiding feature in dock bar (similar to auto hide feature in windows task bar). As per my knowledge only possible way to implement auto hide is to use SetWindowsHookEx API to create System hook for mouse event.
Now the problem is that I heard that all application that is using SetWindowsHookEx api are detected as spyware by most anti virus and other tools.
Can some one suggest how can I use SetWindowsHookEx safely or any other way to implement auto hide feature in these kinds of applications.
http://Faq.Programmerworld.net
(FAQ and Tips for programmers)
|
|
|
|