|
Thnaks,
Once I made sure that all initialization and COM calls came after the dll has been loaded - things worked out. I had to instantiate the global objects in an exported Init function subsequent to loading as you had suggested, and have a corresponding ShutDown function that cleaned up the gloabal objects before dll was unloaded. Having the cleanup code as part of unloading the dll frequently led to access violations.
|
|
|
|
|
In my application I've set the REALTIME_PRIORITY_CLASS.
It manages a worker thread that works at REAL_TIME_PRIORITY_LEVEL
(while the main thread has been set at IDLE_PRIORITY_LEVEL).
The goal'd be to let the worked thread to loop periodically
with its own multimedia timer without being stopped by the
user interface (in example when the user clicks the mouse).
My problem is that when the user stimulates the user interface
(mouse and windows) the worker thread stops for a while.
How can I let my theard loop without being affected by the
user actions ?
Is there a way to let the user interface to have really a very low
priority ?
Thanks a lot !
|
|
|
|
|
Hello,
You can try to set the prioity of your process to a higher level. Windows will give your process a bigger timeslice. Your process will give most of the time to your worker thread.
But be carefull with setting your process priority to realtime. If you do this, Windows will give almost all the time to your process and other applications could 'freeze' because there is no time left..
Hope this helps.
I also got the blogging virus..[^]
|
|
|
|
|
Thanks for your help but, as I've written in my first post,
I think to have already done what you say. I've used the following instructions in the InitInstance function of the App class:
SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);
SetThreadPriority(THREAD_PRIORITY_IDLE);
Then I've used the next call in my worker thread:
SetThreadPriority(THREAD_PRIORITY_TIME_CRITICAL);
Is there something more to do ?
|
|
|
|
|
Hello,
There could be many reasons for your worker thread to stop for a while. A few of these reasons could be:
<list> Your processor is slow
Your GUI thread synchronizes access to some object with your worker thread using synchronization objects, that block your worker thread
The library that you are using is not very optimized
...
It should not be neccesary to set your process priority to realtime. If you don't let your worker thread run in it's own seperate process, windows ensures that it will always be interupted when the user stimulates the GUI...
I also got the blogging virus..[^]
|
|
|
|
|
Ok, so... as I was thinking the only way to really separate a thread by the user interface is to create it in a separate process created by the main application.
Thanks a lot for your advice !!
|
|
|
|
|
|
I'm stuck and would be really grateful if someone could help. I have written an application that builds an application to run on a Linux system!
The windows application that builds the Linux app has to create .cram files. the only way i know of doing this is using mkcramsf.exe but, with the size of the .cram file i am making, this takes ages (over 5 hours on a low spec PC!)
If i could find some source code on making a cram file i could embed that code into a function in one of my application classes and therefore speed the process up by a considerable ammount. It would appear (looking at examples available on the web) that this is not a common thing to attempt to acheive so i would be very grateful if anyone could help!
Thanks in advance to anyone who can.
steve333
|
|
|
|
|
I've tried to load the bitmap, which is already located in Access, to a picture loadbox on a FormView.
The process is that when I click a next button from a tool bar, the person's info. is changed.
When the program is run, the picture of the first person's image is loaded but not all people.
I wanna know DIB Funtion but all sources are based on API(Actually I am a real beginner.)
I've searched some books but the book explains just basic DIB process and just basic DB access.
Appreciate your advice that which Funtion prefer to.
Especially, what kind of process will be the best to get the bitmap image from the Access to the FormView.
Simple source will be more helpful.
Thanks and regards,
|
|
|
|
|
I'm trying to get the command line parameters of a running process. Does anyone know how to do this? I know I can set a windows hook with WH_SHELL, but I would like to be able to do it on the fly instead of having my application started before the processes I'm trying to view.
-- Rocky Dean Pulley
|
|
|
|
|
You could use the GetCommandLine API.
Put this API in a function and run the function remotely using CreateRemoteThread.
« Superman »
|
|
|
|
|
Thanks, that's what I'm about to try. I was hoping there was a way to do it without injecting anything but this will do I think.
Thanks,
-- Rocky
-- Rocky Dean Pulley
|
|
|
|
|
The fourth parameter to CreateRemoteThread() is the starting point of the new thread. How do you go about getting that starting point (i.e., function) into the other process?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
rocky_pulley wrote:
I'm trying to get the command line parameters of a running process.
See here.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hello,
I am facing with a problem while trying to allocate very large memory by AWE APIs on Windows 2003 Advanced Server. I developed following code in order to allocate large memory portion, but I couldn't allocate it;
#include "stdafx.h"
#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <stdio.h>
#define MEM_ALLOC 1024 * 1024 * 1024 * 4 // allocate physical memory
int _tmain(int argc, _TCHAR* argv[])
{
struct {
DWORD count;
LUID_AND_ATTRIBUTES privilege[1];
} info;
HANDLE token=0x0;
BOOL result=FALSE;
int iPageCount=0x0;
int PFNarraysize=0x0;
ULONG_PTR NumberOfPages=0x0;
ULONG_PTR* PFNarraylist=0x0;
SYSTEM_INFO sys_info;
PVOID lpMemoryWindow=0x0;
// get system page size
GetSystemInfo(&sys_info);
// calculate how many pages required
iPageCount = MEM_ALLOC / sys_info.dwPageSize;
// PFN requested size
PFNarraysize = iPageCount * sizeof(ULONG_PTR);
// allocate array for PFN array
PFNarraylist = (ULONG_PTR*)HeapAlloc(GetProcessHeap(), 0, PFNarraysize);
// ------------------------------------------------------------- //
// check user privileges in order to lock memory on the system
result = OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &token);
// set privilege attributes
info.privilege[0].Attributes = SE_PRIVILEGE_ENABLED;
// lookup user privileges
result = LookupPrivilegeValue(NULL, SE_LOCK_MEMORY_NAME, &(info.privilege[0].Luid));
// info count
info.count=0x1;
// retrieve user privilege
result = AdjustTokenPrivileges(token, FALSE, (PTOKEN_PRIVILEGES)&info, 0, NULL, NULL);
// close token handle
CloseHandle(token);
// ------------------------------------------------------------- //
// create memory window
lpMemoryWindow=VirtualAlloc(NULL, MEM_ALLOC, MEM_RESERVE | MEM_PHYSICAL, PAGE_READWRITE);
NumberOfPages = iPageCount;
// allocate physical memory - I
result = AllocateUserPhysicalPages(GetCurrentProcess(), &NumberOfPages, PFNarraylist);
// map user physical page to the window - I
result = MapUserPhysicalPages(lpMemoryWindow, iPageCount, PFNarraylist);
// use memory
lstrcpy((LPSTR)lpMemoryWindow, TEXT("OGED"));
}
In the example that I wrote above can allocate 2 gb or less memory but not more and I am sure that I have 16 Gb physical memory.
How can I allocate and use more than 4 Gb memory? Can anybody give an example about AWE?
PS: I am aware about MSDN AWE and MSDJ - 99 examples, but they are not a solution for my case.
Regards,
Orkun GEDiK
SAP R/3 Software & System Support Specialist
ASTRON
|
|
|
|
|
You do not say it or not, but are you booting with the /PAE switch? You need it to enable applications to address at and above 4GB. Normally, you can only address 2GB unless you booted with the /3GB switch.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Hello,
Sorry, I forgot to say that, "I am using /PAE switch already".
Regards,
Orkun GEDiK
SAP R/3 Software & System Support Specialist
ASTRON
|
|
|
|
|
Codeguru,
I have a property sheet, which contains a nmber of property pages. One of the pages contains a CTreeCtrl.
The tree control is used to display a list of items with tick boxes. The list of items never changes, however the ticks next to then respond to changes in the document structure.
I use OnInitDialog to create the list of elements using InsertItem and also log the handles for later use.
I then use OnSetActive to record each time the user clicks the page and update the tick boxes using SetCheck and the recorded handles from OnInitDialog.
My problem:...
The property page has to be shown twice, first the items appear and second the tick boxes are correct. Thereafter everything works fine.
I'm presuming this is because the inserted items have not been activated until after the page is made visible? Therefore SetCheck doesn't do anything on the first pass. But I've tried to resolve this with a call the the property sheet to call another page, using SetActivePage(*), then reactivating the current one. However, this doesn't work. Also tried various update calls inbetween OnInitDialog and OnSetActive, but to no avail.
Any ideas what I'm doing wrong? The help would be very much appreciated
James
|
|
|
|
|
I remembered dealing with a quirky problem involving CTreeCtrl checkboxes. I checked some code in an old project, and found this:
<br />
<br />
m_treeCtrl.ModifyStyle(TVS_CHECKBOXES, 0);<br />
m_treeCtrl.ModifyStyle(0, TVS_CHECKBOXES);<br />
The fix came via the one of the newsgroups. I don't know if it will help your problem, but it's worth a shot.
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
Thankyou, thankyou, thankyou!!!!
As I expected, a random bug with a very random solution.
But it works
|
|
|
|
|
Please tell me that why does the first two bytes of a Bitmap image is being shown as '19778' which is equal to '4D42H' in VC environent.
whereas in theory it is to be 'BM' which is '424DH' in the bitmap image.
MoQuisha
|
|
|
|
|
Ascii Code of 'B' = 0x42
Ascii Code of 'M' = 0x4D
'BM' is the signature of the bitmap file, it helps the image viewers to identify that this file is a bitmap file. If you rename a text file and make its extension .bmp than it does not mean that it is a windows bitmap file.
http://www.priyank.in/
|
|
|
|
|
Hello,
It has something to do with the way data is stored in the memory of the computer. This problem is also known as the NUXI problem.
Read this[^] for more information about the problem.
I also got the blogging virus..[^]
|
|
|
|
|
|
Hello,
I have the following code:
<br />
#define A_THING(ARG) \<br />
# define ANOTHER_THING const ARG \<br />
When I compile the code, I get the following error: "error C2162: expected macro formal parameter"
The following code does not produce errors:
<br />
#define A_THING() \<br />
# define ANOTHER_THING const ARG<br />
The most weird part is, that I don't even use the first macro in the code. If I use it, I get the same errors...
I also got the blogging virus..[^]
|
|
|
|