|
Thank you very much
AHMAD ALWASHALI
|
|
|
|
|
HI ALL
My qustion about
bitwise left shift and sight shift Operators << , >>
I don't understand what it does,I searched in MSDN i found
that :
The bitwise shift operators shift their first
operand left (<<) or right (>>) by the number
of positions the second operand specifies.
and then give me this example :
// Example of the bitwise right shift operator
int nNumA=8; // beginning value is 8
nNumA >> 2; // ending value is 2
what this does the (nNumA) stil has the value (8)
Can you tell me what the << , >> do, and when I use it.
THANK YOU
AHMAD ALWASHALI
|
|
|
|
|
Ahmad
the bitwise operators move the bits in a variable left or right the number of positions requested. Take the following code snippet for example.
void main()
{
int nNumber = 8;
nNumber >> 2;
}
If you move the bits set to 1 too far to the left or right they just drop off the end and are lost.
Hope that helps.
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|
|
Thank you very much
AHMAD ALWASHALI
|
|
|
|
|
i want to use my program to replace the windows logon dialog box on windows 98/nt/2000,who can tell me what should i do,especally on 98;P
|
|
|
|
|
Hi
I need to call a dos command in my program, which is a win32 console application. Does anyone know how?
Thanks
kk9
|
|
|
|
|
Try system("dir"); or system("command /k dir "); (or cmd for NT). The /k switch leaves the user at the command prompt until they type exit to return to your prog, so this acts as a sort of 'shell to DOS' command.
|
|
|
|
|
If I understand you correctly you wish to call a DOS command from your program without suspending the running of it or forcing a Command Prompt to appear for the running of any commands. If this is correct, you need to call the system function.
int system( const char *command );
Only problem with this is the fact it can only return an int to tell you if it worked or not and also any error that occurred via errno. If you wish to get access to the response of the DOS command you would I suppose have to pipe the DOS command to a file ie. [nRetVal = system("dir C:\Program Files > C:\Output1.txt")] and then parse the results from the file later in your program.
Hope this helps.
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|
|
Question Summary: How do you customize the "tooltips" displayed by Intellisense?
Question Details:
I am trying to customize the "tooltips" that show up as a part of Microsoft's Intellisense "Auto Complete" feature.
For example, while building an ASP page in Visual InterDev, if I type "Request" and a dot (.), an Intellisense window "pops" up and displays the properties and methods that the ASP Request object supports. As I scroll down the list of available methods and properties, an "information" tooltip appears to the right of the drop down list.
I have been able to trace the content of these "information" tooltips back to the type library ASP.tlb. The same "information" string appears in the helpstring attribute. It would seem that this is the source of the text that Intellisense uses. (If this observation is incorrect, please let me know)
When I created a test component, I put my own detailed help "information" string in the helpstring attribute. However, when I do this it does not show up like it does for Microsoft's intrinsic ASP objects. In fact, it does not show up at all.
What am I doing wrong? Why is Microsoft able to do this and I am not? Is there a different IDL attribute to set, or perhaps a different IDL compiler is required?
Thanks in advance for any advice or recommendations. If anyone knows of good documentation of Microsoft's Intellisense, that would be great too.
Sincerely,
Trong Ha
|
|
|
|
|
I only have experience with C++ so I do not know if this would apply to ASP...
Intellisense uses comments located around the source code. E.g.
class Foo
{
// Method description
int Func();
int _value; // Variable description
};
void main()
{
Foo f;
f.// Intellisense pops up now
}
Once the period is typed Intellisense comes up. When you highlight "Func" it will display "Method description" from the comment above the method declaration (it removes the //). Same thing for a variable. If it doesn't find a comment above the declaration it looks after it.
I have noticed sometimes it works right after I #include the file; sometimes it will not work until a close and re-open the project. I've also noticed that it does not always work with COM interfaces.
I don't know if any of this relates to ASP but I thought I would share my experience with Intellisense in case it does.
|
|
|
|
|
I'm doing a programatic install of device drivers in NT, but before I do it, I would like to make sure the user has permissions to do so (and fail gracefully if they don't).
I'm looking at NetUserGetInfo() but it doesn't appear to be behaving as expected.
Some additional details:
Look up rights from the local machine first
look up rights from the domain controller (of the primary domain)
If they have admin rights, groovy. If not, die (which I can do )
Does anyone have some sample code that I can use?
Thanks!!
--Dave Weber
|
|
|
|
|
Found this in "Taking Object Ownership" in the MSDN:
HANDLE hToken;
if (!OpenProcessToken( GetCurrentProcess(),
TOKEN_ADJUST_PRIVILEGES, &hToken) {
printf("OpenProcessToken failed: %u\n", GetLastError() );
return FALSE;
}
if (! SetPrivilege(hToken, SE_TAKE_OWNERSHIP_NAME, TRUE) ) {
printf("You must be logged on as Administrator\n");
return FALSE;
}
Might be other ways, but this seems kind of short and sweet
|
|
|
|
|
It works! Thanks!
It's not short though. You have to define SetPrivilege(...)
It's in MSDN "Taking Object Ownership"
BOOL SetPrivilege(
HANDLE hToken, // access token handle
LPCTSTR lpszPrivilege, // name of privilege to enable/disable
BOOL bEnablePrivilege // to enable or disable privilege
)
{
TOKEN_PRIVILEGES tp;
LUID luid;
if ( !LookupPrivilegeValue(
NULL, // lookup privilege on local system
lpszPrivilege, // privilege to lookup
&luid ) )
{ // receives LUID of privilege
printf("LookupPrivilegeValue error: %u\n", GetLastError() );
return FALSE;
}
tp.PrivilegeCount = 1;
tp.Privileges[0].Luid = luid;
if (bEnablePrivilege)
tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
else
tp.Privileges[0].Attributes = 0;
// Enable the privilege or disable all privileges.
AdjustTokenPrivileges(
hToken,
FALSE,
&tp,
sizeof(TOKEN_PRIVILEGES),
(PTOKEN_PRIVILEGES) NULL,
(PDWORD) NULL);
// Call GetLastError to determine whether the function succeeded.
if (GetLastError() != ERROR_SUCCESS)
{
printf("AdjustTokenPrivileges failed: %u\n", GetLastError() );
return FALSE;
}
return TRUE;
}
It's a common enough thing to have to do. I'm sure there must be some built in function somewhere.
|
|
|
|
|
I am having trouble recasting a void pointer - can someone please help me.
My code looks like this:
void* structure = NULL;
...
structure = (CWPSTRUCT*) lParam;
hwnd = structure->hwnd;
when I compile, I get this error:
error C2227: left of '->hwnd' must point to class/struct/union
I am a bit confused as CWPSTRUCT is a structure and the error is not generated on the line where the casting is done.
Thanks,
Andrew
Andrew Traub
CompuFlash, Inc.
http://www.compuflash.com
|
|
|
|
|
You need to do this:
CWPSTRUCT * structure = NULL;
...
structure = reinterpret_cast<CWPSTRUCT *>(lparam);
hwnd = structure->hwnd;
The problem was that you told the compiler that structure was a void pointer, not a pointer to CWPSTRUCT, when you declared it.
He was allying himself to science, for what was science but the absence of prejudice backed by the presence of money? --- Henry James, The Golden Bowl
|
|
|
|
|
I havent programmed so much before, and I wonder how I can switch between two forms in a window. I am using visual c++ 6.0. My goal is that when I push a button one form is going to appear, and when I push annother button the other form is appearing. If anyone can help me I would be grateful.
|
|
|
|
|
Hi
I would like to grey out an item in the Tree of Outbarcontrol.
Pl let me know how to proceed.
Karthik
|
|
|
|
|
I created a small browser with Internet Explorer Component, and i'd like to use proxy like IE do, but i don't know how??
Help!!
|
|
|
|
|
I try to write an application what is using the CHTMLView. That is quite simple. Next I wanted to implement that I get informed about when somebody clicks on a link, so I can react on it by something else than browsing to the
destination, i.e. to call another functions in this application.
In general it works using the CHtmlView::OnBeforeNavigate2 function. I can hook into this call, can do something else and can prevent that the browser tries to open the link, but later I get an error message that i havn't handy now.
So my question would be: Am I using the right approach, or am I absolutely wrong? Does somebody have a sample on this?
Thanx in advance,
--
regards Matthias
|
|
|
|
|
Am I using the right approach, or am I absolutely wrong?
Sounds good to me. This is the way I do it.
OnBeforeNavigate2Explorer(LPDISPATCH pDisp, VARIANT FAR* URL, VARIANT FAR* Flags, VARIANT FAR* TargetFrameName, VARIANT FAR* PostData, VARIANT FAR* Headers, BOOL FAR* Cancel) <br />
{<br />
char pmbbuf[MAX_PATH];<br />
strcpy(pmbbuf, (char*)(_bstr_t)URL->bstrVal);<br />
<br />
if(pmbbuf == the_link_i'm_overriding)<br />
{<br />
DoSomething();<br />
*Cancel = TRUE;<br />
}<br />
}
|
|
|
|
|
I'm writing an application that try to spy IE's HTTP requests.
I want to get the headers and the respons headers.
But OnBeforeNavigate2 gives only additional headers and
there is no way to get respons headers at all.
How can i do that?
I think about getting the IPersist object of IE
and then somehow add notification, but don't know
how this can be done or if it worth trying.
- - - - - - - - - - - - - - - - - -
Memory leaks is the price we pay \0
01234567890123456789012345678901234
|
|
|
|
|
i need help !!
i have a check box who i checked the push button properite .
the Question IS how i put bitmap on the push button when the button ON
and another bitmap(picuter) When the button is OFF?!
(Change the bitmap with check box status)
Ron
|
|
|
|
|
Look at CBitmapButton - it allows you to set a bitmap for pressed, not pressed, focus off and a fourth state that I can't remember !!!!
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Hi there,
Well I have a strange problem.
I'm Using Access 2000 DB and i'm connected through ODBC Drivers in MFC using CRecordset.
I have a Table with a field of type Date/Time in Access 2000 DB , which the CRecordset uses :
RFX_Date(pFX, _T("[FirstInstallDate]"), m_FirstInstallDate);
(to exchange data between the Recordset itself and the Database.)
all i do before this is :
rsRecSet.m_FirstInstallDate = CTime::GetCurrentTime();
and the definition is :
CTime m_FirstInstallDate;
Everytime i get to this line i have a notification in DEBUG MODE :
Microsoft Visual C++ : Unhandled exception in MyApp.exe (MFC42D.DLL): 0xC0000005: Access Violation.
and the App. is stuck and i can't go on .... but the record is written and in a right way ... ????
and when i run the same App. in RELEASE MODE it Closes with Abotion Message.
Does somone have any idea ????
Thanks alot,
Ariel.
|
|
|
|
|
Hi.
How could I simply send an e-mail message in a VISUAL C++ application ?
Do I have to use MAPI ?
Thanks.
|
|
|
|