|
euacela wrote: dude shut the f*** up;
calm down buddy..... ok i will not come in your way!
|
|
|
|
|
Hi,
Which is the last message processed by a normal WindowProc?
Is it WM_DESTROY ?
Thank you...
- NS -
|
|
|
|
|
I think WM_NCDESTROY is amongst the last.
Steve
|
|
|
|
|
Yes, as per my knowledge WM_DESTROY is the last message processed by WinProc function. Because after recieving this message it starts destoying the memory used by window, and released the window resources. And obviously, the message queue will be no longer exist after resource release, and the window no exists to receive any msg...
-Malli...!
|
|
|
|
|
|
Hello Friends !
I'm trying to build the recordset with custom fields those are not taken from any table. This i can do in VB as below
Public ResponseInfo As ADODB.Recordset
Set ResponseInfo = New ADODB.Recordset
ResponseInfo.CursorLocation = adUseClient
Do Until <somecondition_overhere>
ResponseInfo.Fields.Append "MsgFieldName",adVarChar,250
Loop
ResponseInfo.Open
ResponseInfo.AddNew
'some blaa blaa manipulation with ResponseInfo
This is working fine in vb. but what i implemented in VC++ (Using #import "msado15.dll")is not working. Because Open() doesn't take 0 parameters. so, is ther any other logic to build such dynamic recordset (recordset holding dynamic coulmns, those are not from tables). I wanna to add columns of recordset dynamicaly, that too the columns are note associated with any table (this is mendatory point).
Please get me some help...!
-Malli...!
|
|
|
|
|
guess it depends on what you're trying to do. if you actually want to add them to a table later, why not just use a 'CREATE TABLE' statement, execute it, then make a recordset based on that table. then populate it with whatever you want. Or make a dummy SELECT statement from a real table something like this:
select cast('' as varchar(250)) as MsgFieldName from realtable
I just tried this in query analyzer and it works. You could do that for all the field names so that if you actually have a connection, it won't matter which table you pick, just pick any. Add the other fields as appropriate.
My Music | My Pics | My Articles
BlackDice
|
|
|
|
|
Thanks BlackDice !
I was using the same logic before i.e. create table wala. Yours one is really nice code ! It worked fine ! one more problem i suffered is that, i couldn't update the rows of the recordset. I've put the code showing how I coded. Can you get me some help, to update the recordset (insert record or update values of fields).
sprintf(SqlTempQuery,"select cast('FieldValue' as varchar(20)) as testcolumns from tmptable");
pTemRec->Open(SqlTempQuery,_variant_t((IDispatch *) pConn, true),adOpenDynamic,adLockBatchOptimistic,adCmdText);
pTemRec->AddNew("testcolumn","10"); //this line gives runtime error//
Error Description what I got from catch block is : "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done."May I get more light on the issue... Get me some logic to get work done...!!!
-Malli...!
|
|
|
|
|
I have string of Hex values,so i should concatenate two hex values from the string and wanted to convert these Hex values to Binary format and after converting to binary, how should i mask the last three binary values?
|
|
|
|
|
srija wrote: the last three binary values
are you talking about bits, bytes, or something else ?
to convert from hexa representation to binary representation, it's easy. each hex character equals 4 bits :
CString strBinary;
switch (char cHex) {
case '0': strBinary = "0000"; break;
case '1': strBinary = "0001"; break;
case '2': strBinary = "0010"; break;
case '3': strBinary = "0011"; break;
case '4': strBinary = "0100"; break;
case '5': strBinary = "0101"; break;
case '6': strBinary = "0110"; break;
case '7': strBinary = "0111"; break;
case '8': strBinary = "1000"; break;
case '9': strBinary = "1001"; break;
case 'A': strBinary = "1010"; break;
case 'B': strBinary = "1011"; break;
case 'C': strBinary = "1100"; break;
case 'D': strBinary = "1101"; break;
case 'E': strBinary = "1110"; break;
case 'F': strBinary = "1111"; break;
}
|
|
|
|
|
I said about bits. I have array[6]={0x7D 0x0c 0x2f 0x65 0xA5 0x4B}...
I should convert all Hex bytes to Binary format and then i should concatenate.
for Eg:0001111111111111, now i should mask the last three bits i,e 000.
|
|
|
|
|
if only the 3 bits are important for you there, you don't need to make all the concatenation stuff... only get the last byte (here 0x4B ), cast it into an int (char c = array[5] ) and mask it : c = c & 0x07
|
|
|
|
|
Yes, you are correct, just i used strcat(), it worked for me.
now i got one more problem, how can i represent a binary value of 11100001110 into a decimal?
|
|
|
|
|
srija wrote: ...how can i represent a binary value of 11100001110 into a decimal?
Are you wanting to know how to represent a base-2 number as base-10 instead?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Can i use atoi function????plz check this??
s[20]=11100001110
int power = 1;
int sum = 0;
for (int i = l-1; i >= 0; l--)
{sum += power * atoi(s[i]);
power = power * 2;
}
printf("%d", sum)
|
|
|
|
|
but atoi fuction si not working
|
|
|
|
|
Why go to all of this trouble when strtoul() will work just fine?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
yes, i need it so... the value of 11100001110. i,e some 1806 or so...
|
|
|
|
|
I am not sure what you mean with masking, but if you like to extract a hexadecimal value from a string and want to set the last 3 bits to 0 you can do it like this:
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char **argv) {
char myHexString[] = "1A";
unsigned char myByte = 0x0;
sscanf(myHexString, "%X", &myByte);
myByte &= 0xF8;
printf("%d, 0x%x\n", myByte, myByte);
return 0;
}
Hope that helps you out.
Walter
-- modified at 7:55 Thursday 2nd March, 2006
|
|
|
|
|
Hello Friends !
I wanna to implement custom recordset (with dynamic fields,i.e. not from any table). Here I can do in VB as below :
'ResponseInfo is an ADODB recordset.
Public ResponseInfo As ADODB.Recordset
Set ResponseInfo = New ADODB.Recordset
Do Until <somecondition_overhere>
ResponseInfo.Fields.Append "FieldName", adVarChar, 250
Loop
ResponseInfo.Open
ResponseInfo.AddNew
'some blaa blaa
ResponseRs.MoveFirst
Do Until ResponseRs.EOF
'some blaa blaa code over here
ResponseRs.MoveNext
Loop
hope so, you've got what I wanna to do. Here I'm just building the recordset with dynamic field definitions, no query/table is used to build the recordset. So, I tried the same in VC++ (using #import "msado15.dll") , but it's not working. The open() requires the parameters, is there any other solution for this, so that i can build the recordset with custom columns (not building rset from any table/database).
Please get me some help...!!!
-Malli...!
|
|
|
|
|
you can specify the SQL query string to _RecordsetPtr after you build the table,like
m_pRecordSet->Open("Select name,caption from users", m_pConnectionString, <br />
adOpenKeyset, adLockOptimistic, adCmdText);
|
|
|
|
|
If we luanch console app from win app with createprocess() it returns immediatly while for example if console app takes several secs to execute can we make createprocess() run in blocking mode that is it should not return until console app terminates??
9ine
|
|
|
|
|
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
// Start the child process.
CreateProcess(
NULL,
"C:\\Windows\\Notepad.exe",
NULL,
NULL,
FALSE,
0,
NULL,
NULL,
&si,
&pi );
CloseHandle(pi.hThread);
// Wait until child process exits.
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hProcess);
Steve
|
|
|
|
|
Great thanks.
But should we close thread handle before process is terminated?
9ine
|
|
|
|
|
Closing a thread or process handle doesn't terminate the thread or process.
Steve
|
|
|
|