|
For drive-letter you can use GetDriveType (too obvious? ).
For the NT-only device specifications ("\Device\Xxx") I think you'd have to either get the drive-letter for that device or use some DDK function (AFAIK it's only the DDK that documents NT-only, non-Win32, functions).
|
|
|
|
|
I created a database, now I want to fill in the fields. The way I've seen is to do an AddNew with the recordset. But I have no records! Is it okay to do a SQL query (select * from Table) to retrieve a recordset object?
Appreciate your help,
ns
|
|
|
|
|
|
as far as i know, it`s ok to do that.
|
|
|
|
|
I've made an application to get meteo data from a server and to draw a graphic, it is possible to save it to a file. Well, when I download and draw a file, the first item of MRU files never works, neither if I try to open it with the 'File Open Dialog', but the another three items in MRU work fine. I suppose it assumes than the first item is the one loaded at screen but it's not true. What could be the problem?
|
|
|
|
|
I'm trying to use sendmessage to a button in a dialogbox. It seems its not working. I must have the parameters wrong or something. Any ideas.
Thanks
|
|
|
|
|
It should be defined something like this:
LRESULT SendMessage( UINT message, WPARAM wParam = 0, LPARAM lParam = 0 );
How are your parameters set up?
Nick Parker
The greatest lesson in life is to know that even fools are right sometimes. - Winston Churchill
|
|
|
|
|
Try this solution.
::SendMessage(m_Button.GetSafeHwnd(), Message, WPARAM, LPARAM)
Kuphryn
|
|
|
|
|
There's no way to know what's wrong unless you post your code.
--Mike--
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Hi
try
{
}
catch(...)
{
}
this catch will catch any error. how to get this error information which cause the catch
Gau..
Gaurika Wijeratne. // www.gaurika.com
|
|
|
|
|
That is the problem with the ... catch all operator, there is no way to get the error information. This should be used as a just in case mechanism.
Hopefully you know what type of error will be thrown and you can look for that particular type of exception.
try
{
}
catch (CException &err)
{
}
catch (DWORD &err)
{
}
catch (...)
{
}
You can catch class objects, native data types or do the catch all. The most important thing to remember is to place the exception catch code that is the most detailed or most important to you first in the chain. Because if it is possible for the exception to be casted or converted into one of the other forms in order for the handler to work, it will.
Good Luck
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!
|
|
|
|
|
To add to Paul's excellent comments:
It's best to derive all your exception classes from one base class, such that you can simply catch any of them in one clause. Then you can leave the catch(...) clause for things that would not otherwise happen if your code were bug-free, such as access violations.
try
{
...
}
catch (BaseExceptionClass& e)
{
}
catch (...)
{
}
Regards,
Alvaro
Insanity: doing the same thing over and over again and expecting different results. - Albert Einstein
|
|
|
|
|
I have two sets set1, set2. They have some elements in commmon. I want to make a set3 which is the unique elements from both set1 and set3.
What i mean is if set1 has a,b,c,d,e
set2 has b,c,e,f,g,
Then I want set3 to have in it: a,b,c,d,e,f,g. I'm using a set because it wont have duplicate elements. But I dont know if you can do:
set3 = set1+set2?
Do I have to use iterators and do something like copy both set1, set2, into set3?
Appreciate your help,
ns
|
|
|
|
|
|
Daniel Turini wrote:
You can use STL's set_union available in #include <algorithm>
You can still run into duplication with set_union, here is an example I found showing this:
inline bool lt_nocase(char c1, char c2) { return tolower(c1) < tolower(c2); }
int main()
{
int A1[] = {1, 3, 5, 7, 9, 11};
int A2[] = {1, 1, 2, 3, 5, 8, 13};
char A3[] = {'a', 'b', 'B', 'B', 'f', 'H'};
char A4[] = {'A', 'B', 'b', 'C', 'D', 'F', 'F', 'h', 'h'};
const int N1 = sizeof(A1) / sizeof(int);
const int N2 = sizeof(A2) / sizeof(int);
const int N3 = sizeof(A3);
const int N4 = sizeof(A4);
cout << "Union of A1 and A2: ";
set_union(A1, A1 + N1, A2, A2 + N2,
ostream_iterator<int>(cout, " "));
cout << endl
<< "Union of A3 and A4: ";
set_union(A3, A3 + N3, A4, A4 + N4,
ostream_iterator<char>(cout, " "),
lt_nocase);
cout << endl;
}
The output is
Union of A1 and A2: <font color="red">1 1 2 3 5 7 8 9 11 13</font>
Union of A3 and A4: <font color="red">a b B B C D f F H h</font>
I suppose you could sort your two maps and create a third where you use an interator and the find function to make sure that you have only added the value from either maps when it is not in map number 3 based on the iterator. A simple for loop should do the trick, however maybe someone else has a more efficient method to do this.
HTH
Nick Parker
The greatest lesson in life is to know that even fools are right sometimes. - Winston Churchill
|
|
|
|
|
|
Daniel Turini wrote:
Isn't the purpose of the set class being a container of unique items?
I haven't been playing around with STL very much, I was reading this[^] when I saw the message come up. You could be correct.
Nick Parker
The greatest lesson in life is to know that even fools are right sometimes. - Winston Churchill
|
|
|
|
|
The following example shows using set_union to do a union of sets:
<br />
using namespace std;<br />
<br />
<br />
class PrintInt<br />
{<br />
public:<br />
void operator() ( int value )<br />
{<br />
cout << value << endl;<br />
}<br />
};<br />
<br />
<br />
int main()<br />
{<br />
set<int> setA;<br />
set<int> setB;<br />
set<int> setC;<br />
<br />
setA.insert( 1 );<br />
setA.insert( 3 );<br />
setA.insert( 5 );<br />
setA.insert( 7 );<br />
setA.insert( 9 );<br />
<br />
<br />
setB.insert( 2 );<br />
setB.insert( 3 );<br />
setB.insert( 4 );<br />
setB.insert( 5 );<br />
<br />
set_union( setA.begin(), setA.end(), setB.begin(), setB.end(), inserter(setC,setC.begin()) );<br />
<br />
cout << "setC Contents:" << endl;<br />
for_each( setC.begin(), setC.end(), PrintInt() );<br />
<br />
return 0;<br />
}<br />
Best regards,
John
|
|
|
|
|
Thanks so much for the detail. I hadnt figured this out yet...so I'm gladyou showed me how!
Appreciate your help,
ns
|
|
|
|
|
Hi.
I am using WH_CBT hook to trap WM_CREATE message. I want to get the handle,className …………. form CRETESTRUCT pointer which is in the lParam
I cant retrieve this information I tried every thing I know. Can some body please
Help me
Regards
Gau.
;);P
Gaurika Wijeratne. // www.gaurika.com
|
|
|
|
|
What have you tried, and what are you experiencing that is preventing from letting you get this information?
I just want to be clear on one other thing, are you using the CREATESTRUCT structure?
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!
|
|
|
|
|
Yes I am using CREATESTRUCT structure.
it doesn't give any errors. I casted the lParam to CREATESTRCT and trying to
get the class name from it. but nothing is coming.
but when I put a catch with "..." ,it is catching a error.
I just want to check the class name with a string and destroy the window if it is a match....
Gaurika Wijeratne. // www.gaurika.com
|
|
|
|
|
It looks to me that the CREATESTRUCT structure is not used directly.
I beleive that it sends a CBT_CREATEWND structure instead, and embedded in that structure is the CREATESTRUCT structure.
[msdn]
CBT_CREATEWND
The CBT_CREATEWND structure contains information passed to a WH_CBT hook procedure, CBTProc, before a window is created.
typedef struct tagCBT_CREATEWND {
LPCREATESTRUCT lpcs;
HWND hwndInsertAfter;
} CBT_CREATEWND, *LPCBT_CREATEWND;
[/msdn]
Try that and see if it helps
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!
|
|
|
|
|
The name may also be stored in an ATOM. Then you can use GetAtomName or GlobalGetAtomName to get the string involved. I don't remember the exact sequence, but FindAtom or GlobalFindAtom might be involved.
Joel Lucsy (jjlucsy@concentric.net)
|
|
|
|
|
Hey, can anyone give me any ideas on where I can look for some info/examples of how to do FTP. I am looking for a way to get an FTP address, password, and username, establish an FTP session, send file(s), close the session, then periodically open the FTP session and see if any files are being FTP'd to me. This functionality is new to me. I am not sure where to look for articles, I am using MFC/C++, no C# or anything like that.
|
|
|
|
|