|
"What are you trying to do with your worker thread?"
Pretty Lot, i am testing huge numbers(100 or more digits )
on primality.
Actually i am doing lots of operations there,probably this makes my cpu go 100% , anyway thanks for attention to all
m0n0
|
|
|
|
|
Change your priority to THREAD_PRIORITY_IDLE instead of the default which is normal. That'll lower the thread priority so it won't take your system with it. The command would be:
CWinThread * threadptr = AfxBeginThread(
pfnThreadProc,
pParam,
THREAD_PRIORITY_IDLE,
0,
0,
NULL
);
|
|
|
|
|
I have written an xll with basic arithmetical calculations. I want to use the debugger to step through those functions to confirm they are working properly. I have tried to do this by setting Excel as the Command application and a spreadsheet that loads the xll as the Command argument. I then place breakpoints throughout the functions. Unfortunately, the VC++.Net debugger never recognises the breakpoints (the warning glyph ? breakpoint appears). The two error messages are firstly:
"Excel.exe does not contain debugging information. (No symbols loaded.) Click OK to debug anyway"
Secondly:
"The following breakpoint cannot be set: When 'double' changes
Data breakpoints are not supported in the Common Language Runtime"
Is the only way to debug an xll/dll to create a separate basic application to call the xll function? Ideally I would want to be able to call from Excel so that I know exactly what Excel is feeding to the xll function parameters. Any thoughts you may have would be appreciated.
Regards
Jeremy
|
|
|
|
|
Could anyone describe me how the process creates threads? I learned that there always exists a primary thread created as soon as the process gets started, but from then, how can we know how many threads are created? and when? and how can we know? can we take control of them?(I don't mention the threads created manually by me on using CreateThread, AfxBeginThread)
Regards.
Grenouille
|
|
|
|
|
well, if you call once AfxBeginThread() , i believe you have only one thread...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
A process can identify all of the threads that it owns by using the Thread32First() /Thread32Next() pair.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
What that complicated?
Just create a Dll file, attach it to the process and the DllMain function will get every time a new thread is created or terminated!
Read about DllMain in MSDN.
Don't try it, just do it!
|
|
|
|
|
Alexander M. wrote:
What that complicated?
What's so complicated about using Thread32First() ? It's very easy to use and only requires a few lines of code. Creating a separate DLL for this task is more along the lines of overkill.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hello to all of you.
If anyone knows I would ge glad if someone could help me on this:
I have a form where there is a panel (call it panel_1). In this panel I want to display 5-6 panels, one at a time, depending on some buttons. Here is what I do. In visual studio .net, I create a new userControl class where I place my panel (panel_2). Then, i go to my main form, where panel_1 is and I add my userControl. But the buttons of panel_2 are BLACK, and it seems that there is no refreshing.
When I run the application, the part of the screen that has panel_2 shows abnormal things such as icons of my desktop!
Is there any bug, when adding userControls. Do i need to do anything, such as repaint or something else?
Thank you in advance!
Kostas Stamatis
|
|
|
|
|
hi there !
i got a crucial problem with my singleton class. maybe there's anybody who could help me out
i implemented a singleton framework as a static lib that handles callbacks, triggers methods etc.. next to this lib, i got several dlls that access this lib.
the problem basically is that every dll allocates its own memory and includes a copy of the lib there. so, from outside (let's say, the testing app), there's not one framework, but several according to the amount of dlls that load the framework.
as there must be only one framework, i'm looking for kind of a workaround to get rid of this "feature".
i've already tried to build the singleton as a dll which then just would be linked to the other dlls, but that didn't show any positive effect either.
so in other words, is there any memory segment (which would be the heap of the current context/process) that is used by all libraries (be it static or dynamic) that i could store at least the singleton pointer in ?
a really quick solution would be to instantiate this pointer at the testing app or create a shared memory object, but these kinds of solution don't satisfy me at all.
as i'm in an absolute rush, pls come back to me as soon as possible. thank you all very much for any hint or opinion.
best regards,
j
|
|
|
|
|
Singleton 'pointer' ? This does not make any sense to me. You can't readily create a pointer to some memory segment that is the same address among all processes.
The address returned by any regular 'malloc' or 'new' calls is not guaranteed to be at the same address in all processes anyway. You can try to FORCE it using some combination of VirtualAlloc and memory mapped file calls, but you always, and I mean ALWAYS, run the risk that some DLL will load at that address anyway. So then by the time your app is running its main loop, you will not be able to allocoate memory at that address anyway.
If you want something 'shared' by all processes, your best bet is to create a memory mapped file and map to it from each process. Put your 'pointer independent' code in that shared memory.
If you want a fixed-size chunk of memory that is shared by all processes that is 'owned' by a DLL, then you can put some variables or data structures into a shared data segment.
|
|
|
|
|
In my application I have a picture box in which I display a bitmap, the bitmap has a number of points on it which I need to join up with an arrow to show the direction of the join (I know where the points are and also the direction).
Does anyone know an easy way to calculate which pixels I need to colour to create this arrowed line.
TIA
|
|
|
|
|
mcsherry wrote:
...to create this arrowed line.
Is LineTo() what you are looking for?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
LineTo() is this using a device context? if so I can't use that (I don't think so anyway ) as I need to actual draw it on the bitmap before saving it all to a file.
cheers,
|
|
|
|
|
Understood, but I think you can still use LineTo() to modify the bitmap, and then display the final result. You need to select the bitmap into a compatible DC, add to it using LineTo() , and then draw it using BitBlt() . Something like:
CDC dcCompatible;
dcCompatible.CreateCompatibleDC(pDC);
CBitmap *pBitmap = dcCompatible.SelectObject(pointer_to_CBitmap_object);
dcCompatible.LineTo(...);
pDC->BitBlt(0, 0, width_of_bmp, height_of_bmp, &dcCompatible, 0, 0, SRCCOPY);
dcCompatible.SelectObject(pBitmap);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
thanks, I'll give that a go.
Andy,
|
|
|
|
|
Where can i find source code?
|
|
|
|
|
Rassul Yunussov wrote:
Where can i find source code?
Google shows a few implementations. But nothing really drop-in ready.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
Hey!
how do I make a multi-column popup menu using e.g. cmenu' popup features ?
Thanks !
- Karmafx
|
|
|
|
|
figured it out...using MF_MENUBARBREAK..doh
-Karmafx
|
|
|
|
|
Hello ,
I have one doubt in MFC.I create one application.In this application i draw one rectangle in the client area.The rectangle contains the Eight handles (MASK) using GetHandleMask().I draw another rectangle same as the first one.Now i drag the second rectangle and fixed in the part of first rectangle.Now click the first rectangle,the handles not shown in the intersected area.How it will show?I need only handle are shown,not line.
Sunsen
|
|
|
|
|
Hello!
I've a problem, i can't show a CStatic in my Dialog!
this is my code:
On OnInitDialog()
<br />
CBitmap m_bmp;<br />
BOOL res = m_bmp.LoadBitmap(IDR_BMP_NEW2);<br />
if (res) MessageBox("Image ok")
<br />
CStatic myStatic;<br />
<br />
myStatic.Create(_T("my static"), <br />
WS_CHILD|WS_VISIBLE|SS_BITMAP|SS_CENTERIMAGE|WS_BORDER, CRect(10,10,150,50), this);<br />
myStatic.SetBitmap(HBITMAP(m_bmp));<br />
when i launch my app, there is nothing on Dialog
plz, help me! thanks
hzocm
|
|
|
|
|
|
I think the problem is due to the fact that your CStatic is a local variable... so it gets destructed at the end of OnInitDialog... declare as a member of the class and you will have more luck!
|
|
|
|
|
thanks very much!
it's ok, i must declare CBitmap and CStatic like a varible of class.
thanks!
|
|
|
|