|
I want to show my Internet Explorer toolbar in Internet Explorer programatically (meaning that after installation the user does not have to access the "View > Toolbars >" in order to display the toolbar). I remember I read somewhere about how you can acomplish this, but cannot find the link anymore.
Anyone care to share some light on this matter?
regards,
Mircea
Many people spend their life going to sleep when they’re not sleepy and waking up while they still are.
|
|
|
|
|
hi,
I am writing a C++ App for for windows, It is a very time critical application and I seem to have a problem when paging is necessary (that was a long debug session).
The server running the program does have any memory problems, it runs on 2GB of RAM and has no other job except that program.
I am using WIN32 API HeapCreate and HeapAlloc functions.
Is there any way to keep the Heap (a few MB) in the physical memory?
|
|
|
|
|
ja1001 wrote: Is there any way to keep the Heap (a few MB) in the physical memory?
Back when we used to use GlobalAlloc() , we could specify the GMEM_FIXED flag. I only use new /delete these days, and keeping memory from being swapped to disk is not a concern.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
ja1001 wrote: It is a very time critical application
Do you need to have a real-time behaviour ? If yes, you will run into troubles because windows is not a real-time operating system ! The CPU time allocated to your program will be shared with the other running processes. You cannot garanty precisions under 10 or 20 msec (depending on a lot of factors).
|
|
|
|
|
|
VirtualLock
The VirtualLock function locks the specified region of the process's virtual address space into physical memory, ensuring that subsequent access to the region will not incur a page fault.
BOOL VirtualLock(
LPVOID lpAddress,
SIZE_T dwSize
);
Locking pages into memory may degrade the performance of the system by reducing the available RAM and forcing the system to swap out other critical pages to the paging file. Each version of Windows has a limit on the maximum number of pages a process can lock. This limit is intentionally small to avoid severe performance degradation. Applications that need to lock larger numbers of pages must first call the SetProcessWorkingSetSize function to increase their minimum and maximum working set sizes. The maximum number of pages that a process can lock is equal to the number of pages in its minimum working set minus a small overhead.
Pages that a process has locked remain in physical memory until the process unlocks them or terminates.
To unlock a region of locked pages, use the VirtualUnlock function. Locked pages are automatically unlocked when the process terminates.
If memory was allocated with HeapAlloc, you can use VirtualQueryEx to get an appropriate start address.
|
|
|
|
|
This is what I did and the VirtualQueryEX() returend 0 and nothing in the struct.
What am I doing wrong?
void main(int argc, char *argv[])<br />
{<br />
DWORD dwMin, dwMax;<br />
HANDLE hProcess;<br />
_MEMORY_BASIC_INFORMATION MemInfo; <br />
<br />
HANDLE hHeap = HeapCreate(NULL, 1024 * 1024 *20, 1024 * 1024 * 30);<br />
<br />
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, GetCurrentProcessId());<br />
if (hProcess == INVALID_HANDLE_VALUE)<br />
{<br />
printf( "OpenProcess failed (%d)\n", GetLastError() );<br />
return;<br />
}<br />
if (SetProcessWorkingSetSize(GetCurrentProcess(), 1024 * 1024 *20, 1024 * 1024 *30) != 0)<br />
{<br />
printf("Process Size Set!\n");<br />
}<br />
else<br />
{<br />
printf("Error in seting the Process Size!\n");<br />
}<br />
printf("%d\n",VirtualQueryEx(hProcess, hHeap, &MemInfo , 1024 * 1024 *20));<br />
printf("\n MemoryRegionSize: %d\n", MemInfo.RegionSize);<br />
<br />
if (VirtualLock(MemInfo.BaseAddress, MemInfo.RegionSize) != 0)<br />
{<br />
printf("Virtual Lock Success!!!\n");<br />
}<br />
else<br />
{<br />
printf("Virtual Lock Failed!!!\n");<br />
} <br />
CloseHandle(hProcess);<br />
}
HELP?!?!
|
|
|
|
|
The heap create makes a 'region' of memory available thorugh the API. To determine where the memory is actually located, you must use the pointer returned from HeapAlloc. Allocate a small block of memory, say 8 bytes, using HeapAlloc and then pass that pointer into the VirtualQueryEx function.
LPVOID lpMyMem = HeapAlloc(hHeap, 0, 8);
Also, VirtualQueryEx size is sizeof() not the size of the memory you think you got.
VirtualQueryEx( hProcess, lpMyMem, &MemInfo, sizeof(MemInfo) );
This should let you know how much memory the Heap has comitted and reserved, and its true starting address, so you can call VirtualLock.
|
|
|
|
|
Reposting here since I didn't get any responce in the c# forum.
My app's written in c#, but the error's being generated by a win32 api call. I'm using the following 3 api calls as demonstrated in the msdn article to monitor changes being made to a folder over samba (FileSystemWatcher won't do this). In my test app the water class works perfectly. When I use my watcher class in my main app everything is fine with one copy running. With two copies though, FindNextChangeNotification returns false and generates errorcode 0x64006e as returned by Marshal.GetLastWin32Error(). Win32Exception.Message describes this as an uknown error, and no error codes with this large a value are listed in msdn, or winError.h. Looking at the code between my main app and my tester I'm not seeing any meaningful differences, and with an unknown error I don't know wehre to be looking. The biggest difference between the two is that when a change occurs my tester just throws up a message box, while my main app reloads all the files in the folder. (There're only a handful so the performance hit from loading everything isn't enough to justify the extra work needed to ID which file was modified).
FindFirstChangeNotification
WaitForMultipleObjects
FindNextChangeNotification
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/obtaining_directory_change_notifications.asp
|
|
|
|
|
Hi,
in my project i have to use TrimStart(), for this i included "mscorlib.dll",
but i am getting error message as
D:\Sheshidar\DiplomArbeit\DAP\DAPDlg.cpp(8) : fatal error C1083: Cannot open include file: 'mscorlib.dll': No such file or directory
when i searched for help most of the results giving for VC++.Net, but i am working on VC++6.0
can u help me in this how to overcome on this error and how to add mscorlib.dll for my work.
thanking you
have a nice time
ciao
sheshidar patnam
|
|
|
|
|
you can't use the .Net framework in VC 6.0. You will have to use CString or the C-Runtime Library funcitons.
|
|
|
|
|
Thx Willy, but which C-Runtime Library funcitons i have to use instead of Timstart()?
|
|
|
|
|
The easiest way is to use CString LeftTrim, but if you can't use CString. You might be able to use StrTrim, but it will remove the chars from the left and right, so if that will not work for you, you will have to loop through the string.
|
|
|
|
|
FRIEND DONT INCLUDE DLL FILE
dll project generates two important files
1).dll
2) .lib
A)copy these both files in your main project debug dirctory
B)copy the header file of the all\required classes used in DLL PROJECT in to main project directory.
Include these header files wherever it does not identify class
if required.
C)IN MAIN PROJECT Goto Menu Project - > settings open the link tab inthat
Object\link modules type the name of lib file with extension
D) In addition copy the dll and lib in your main project folder also remember earlier i asked to copy in debug folder where your exe gets generated now i am asking just for safety.
REMEMBER DLL IS NOT HEADER FILE TO INCLUDE
still problem contact me
shivditya@hotmail.com
|| ART OF LIVING ||
|
|
|
|
|
where can i find examples for Messages Pumps in MFC.. BTW what's a message pump? does it deal with send,post,despatch,etc??
He is like a one-legged man in a bum kicking competition. -Novjot Sidhu
--[v]--
|
|
|
|
|
VivekuniQ wrote: what's a message pump? does it deal with send,post,despatch,etc??
A program's message loop reads any pending message from the message queue and then dispatches that message back to Windows, which then calls your program's window procedure with that message as a parameter. Without MFC, you are responsible for both the message loop and the window procedure. MFC handles this for you.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
I got this request from my boss.. :
Are you familiar with writing “message pumps”?
This is where you would “push” and “pop” off of dynamic arrays to control threading of commands to API’s.
Multiple threads can “push” messages onto the message stack using a single locking mutex and one single thread “pops” the messages off of the message stack and sends them to the API (using the same locking mutex).
--------------------------------------
what he means actually?.. yeaa we can send messages to the queue.. using sendmessage,postmessage..but should i go for win32 api ? where these messages would be processed by the wndproc ? but whatz the need for mutex here?
--[v]--
|
|
|
|
|
VivekuniQ wrote: one single thread “pops” the messages off of the message stack and sends them to the API (using the same locking mutex)
whatz this i dont understand.. sends them to the API??
He is like a one-legged man in a bum kicking competition. -Novjot Sidhu
--[v]--
|
|
|
|
|
I'm curious why you are being asked to do something that Windows already does and does well. If you use SendMessage() , control does not return until after the window procedure has processed the message. If you use PostMessage() , control returns immediately.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
i guess he's talking in context with the user defined messages.. i'll get back to you after getting a clear requirement.
thanks.
--[v]--
|
|
|
|
|
VivekuniQ wrote: i guess he's talking in context with the user defined messages..
In terms of how the message is entered into the message queue (SendMessage() vs. PostMessage() ), there is no difference between a user-defined message and a system message. If the default window procedure sees a message it does not care about (e.g., user-defined message), the message is ignored. If your window procedure sees a message it does not care about (e.g., system message), the message is ignored.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
i have an application in which microsoft word is embedded. i want to get the caret position. Here GetCaretPos is not working. Can anybody help me out?
i tried Accessible::g_accLocation also.
-- modified at 9:15 Friday 28th October, 2005
|
|
|
|
|
I have some problem with my printer.The code snippet written below is Writting the Text on the Printer.But i am unable to check this with my machine.Can anyone Paste that code & check whether the Text is printing or not.
Steps to Follow:
1) Create a new Dialog Based Application
2) On the OnOk function paste the below code .
Change the printer name as ur own.
--------------------------------------------------------------------
void OnOk()
{
HANDLE hPrinter;
DOC_INFO_1 DocInfo;
DocInfo.pDatatype = "RAW"; // datatype is Null (it can be EMF also)
DocInfo.pDocName = "Named Document"; // Name of the Dopcument
DocInfo.pOutputFile = NULL; // Output is to the printer
DWORD written; // For the number of bytes written to the printer
char cBuffer[20] = "MyTextBuffer\f";
OpenPrinter("Lexmark 2200 Series",&hPrinter,NULL);//you should change
// the name of the printer
StartDocPrinter(hPrinter,1,(LPBYTE)&DocInfo);
StartPagePrinter(hPrinter);
WritePrinter(hPrintercBuffer,sizeof(cBuffer),&written);
EndPagePrinter(hPrinter);
EndDocPrinter(hPrinter);
ClosePrinter(hPrinter);
}
|
|
|
|
|
Hello,
can body tell me how to send email in VC6 using CDO.
|
|
|
|
|
naeemnimi wrote: using CDO.
What's CDO stands for
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|