|
try putting that bit of code in a seperate thread, using the CreateThread function. Call create thread from the entry point.
|
|
|
|
|
So you are saying I should call create thread from where I load the DLL file? And this will in turn always be activated, thus responding everytime the said regirsty key is changed. I'm alittle new at programming C++, sorry. Appreciate the help.
|
|
|
|
|
yes thats exactly wot i mean. but don't create it in DllMain. create it in the function in your dll that is called.
goto msdn.com and familiarise urself with creating thread, cos thats one of the things c++ does best, and is always useful.
|
|
|
|
|
Using DAO and MFC, I loaded an Excel file into CByteArray and then send it off to a field (defined as an "Ole Object" type in an Access 2000 database file) to the same CByteArray. When open the MS Access 2000 file the Ole Object field contains "Long Binary Data". How can view that Excel Ole Object document directly in Acesss 2000? I know that if you Insert the Ole Object manually in Access you are able to double click on the field and Excel would open that Ole Object. Please advise
|
|
|
|
|
I have a dialog based application which runs fine on NT and 2000. However, it doesnt work under XP. I have done some traces, the application gets invoked, but the main dialog window does not appear. Any ideas?
Man Learns from History that he never learns from History
|
|
|
|
|
I used ::LoadImage to load an icon on an owner-drawn button.
On XP only, if the user changes the windows color scheme to "High Contrast#1"
then then images that use the color black are hard to see.
Can I peg the background color of a button so no matter what the user does the image remains unchanged?
thanks
|
|
|
|
|
Check out the LR_LOADMAP3DCOLORS flag for LoadImage. It will change the following colours RGB(128,128,128), RGB(192,192,192), and RGB(223,223,223) to the current system colours COLOR_3DSHADOW, COLOR_3DFACE, and COLOR_3DLIGHT respectively.
You'll need to do this whenever your applications receives WMW_SYSCOLORCHANGE too.
PeterRitchie.com
|
|
|
|
|
Thank you. The WMW_SysColorChange information was very helpful.
|
|
|
|
|
hi
i have created an mfc application and in that i have one dialog box on which i set the bitmap to whole dialog box and i have three buutons on that but when i execute it doesn't show the buttons.
but when i click on that area where button was it dispalys.
I know it is the problem of painting and i tried to solve but not getting the solution.
looking forward for the reply
Best Regards
jhon
|
|
|
|
|
Are your buttons 'inside' a tab control (or another control)? If yes it's possible that the tab control is upper than your buttons thus it will be drawn 'over'. Try to use the BringWindowToTop function for your buttons
Hope this helps
|
|
|
|
|
Anonymous wrote:
i set the bitmap to whole dialog box
By removing the bitmap, do the buttons appear and work? If so, then you know the problem is related to how the bitmap is being drawn.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I am trying to write a wrapper dll for a third party dll. I have previously written a simple application that interacts with the third party dll, and it works fine, but when I put the same code in the dll, it won't load the third party dll.
JNIEXPORT jboolean JNICALL Java_brp_integration_xor_XorBaseJ_initialize(JNIEnv *env, jobject obj, jstring path) {<br />
const char* pathStr = env->GetStringUTFChars(path, false); <br />
HINSTANCE LoadMe = LoadLibrary(pathStr);
env->ReleaseStringUTFChars(path, pathStr);<br />
<br />
<br />
if (LoadMe == 0)<br />
return false; <br />
...code that will never be reached<br />
Has anyone got any suggestions? I have checked pathStr, and it's value is correct.
|
|
|
|
|
What does GetLastError() return right after the LoadLibrary call?
PeterRitchie.com
|
|
|
|
|
It returns ERROR_MOD_NOT_FOUND, which feels a bit embarrasing. The path to the dll is correct though. I have checked it several times. It is possible to load a library that is not in the application's working directory or in a system directory, rigth? Is there any way to see which module is messing with me?
|
|
|
|
|
Hello,
I was wondering, is there a way to determine if a pointer points to data on the heap or on the stack?
I know that you can see if the pointer points 'near' the value of the ESP register, but thats not what I'm looking for...
I also got the blogging virus..[^]
|
|
|
|
|
I remember something about all heap memory having a certain bit set (high bit, bit 6, bit 7?), but I do not remember which it one, or if it is even really true.
Tip: if you are trying to figure out delete this functionality, be careful...!
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!)
|
|
|
|
|
Thanks for your reply!
James R. Twine wrote:
Tip: if you are trying to figure out delete this functionality, be careful...!
This is exactly what I'm trying to do. I alreay implemented the "feature" but it the cost was to disable all the rest for safety reasons. (copy constructor, public destructor, etc..) I want these functions to be available for flexibility, but I think that I have to make a choice...
If I could get the upper bound and the lower boud of the heap address range, than I just could....
I also got the blogging virus..[^]
|
|
|
|
|
These functions may help : GetProcessHeaps() then a HeapWalk()/HeapValidate(). In case of debug build _CrtIsValidHeapPointer.
suhredayan There is no spoon.
|
|
|
|
|
Hi:
I am trying to write an extended ListCtrl class for my own use and as a self-learning exercise. I have a perplexing problem here and I have tried to reduce it to the simplest of possible terms.
The two key code segments are as follows:
A button handler which requests that the list box items be sorted:
void CReportWiseDlg::OnSortBtn()
{
m_nrcDemo.SetRedraw( FALSE );
m_nrcDemo.SortItems( TempCmpFunc, (LPARAM)&m_nrcDemo );
m_nrcDemo.SetRedraw( TRUE );
}
And the CALLBACK function that provides the compare operation. In this case, I wanted to sort by column two which contains floating point values (which I have to convert, of course):
int CALLBACK TempCmpFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
CNiceReportCtrl* pListCtrl = (CNiceReportCtrl *)lParamSort;
CString strItem1, strItem2;
int nItem1, nItem2;
nItem1 = (int)lParam1;
nItem2 = (int)lParam2;
strItem1 = pListCtrl->GetItemText(nItem1, 2);
strItem2 = pListCtrl->GetItemText(nItem2, 2);
double f1, f2;
f1 = atof( (LPCTSTR)strItem1 );
f2 = atof( (LPCTSTR)strItem2 );
if (f1 < f2)
return 1;
else if (f1 > f2)
return -1;
else
return 0;
}
Now, when I click my sort button, I can see my OnSortBtn routine get called. Furthermore, I can see my CALLBACK function getting called several times. For a List box with 8 rows, I counted 13 calls to my CALLBACK. The problem is that every single time the CALLBACK is called, the lParam1 and lParam2 input parameters are ALWAYS equal to ZERO. The net result of this is that the list does not get sorted. It stays exactly the same.
I just followed the example code provided on the MSDN disks for CListCtrl::SortItems. It all looked pretty straight-forward.
Can anybody suggest what might be going on?
Thank you in advance for your help.
Mark
|
|
|
|
|
If I remember correctly, lParam1 and lParam2 of the sorting callback function, do not contain the index of the items to compare, but instead they refer to the user data of those two items (You know, it's the custom value you can associate to any item by calling the function SetItemData )
|
|
|
|
|
Stlan wrote:
If I remember correctly...
You are correct. Most folks do not know that the control calls GetItemData() before calling their compare function. This is why SetItemData() is needed.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi guys,
I once coded a chat program. Server - Client based. It worked like a charm. But the only problem was, that the sever app worked in an endless loop to receive messages and wait for new connections. This raises the cpu to 50 and more per cent.
How can I avoid that? I thought about using threads. But this doesnt seem to solve the problem. What can I do? And if I should use threads, which function to take? There are alot out there.
I am working with visual C++ but NOT with MFC.
DKT
|
|
|
|
|
Try the Winsock Programmer's FAQ
In particular, read
Which I/O Strategy Should I Use?
If I remember correctly, there should be sample C code of the various techinques somewhere on that site.
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
Wow. Thats nice! I will read that!
Thank you!
DKT
|
|
|
|
|
are you using Blocking sockets or Non blocking Socket!
It seems you are using nonblocking sockets which incresing the load on CPU!. try recode you client server using Blocking socket this may help you drop down your cpu usage
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|