|
When using the Visual Studio Installer to create an installation, if I add a VC++ redistributable merge module (.msm) file to the solution, the installation puts the .dll(s) into the target directory.
Is there a way to have the installer put those in a subdirectory of the targetdir without having to open the .msi up with orca.exe and modifying stuff in there?
I'm trying to put those dll(s) in the equivalent of a bin directory along with my other dll(s) and ocx files.
|
|
|
|
|
While creating simple test multithreading application ,I am getting this bug.
I made function global.I dont want to declare static,I dont know whats wrong.
void CCustom1Dlg::OnButton1()
{
// TODO: Add your control notification handler code here
int m = 5;
CWinThread* tt;
tt = AfxBeginThread(Myfunc,&m,THREAD_PRIORITY_NORMAL,0,0,NULL);
}
UINT Myfunc(LPVOID pParam)
{
int* co = reinterpret_cast<int*>(pParam);
return 0;
}
Can anyone tell me,I searched many articles for bug,and all concludes that it must be
global or static,now I have global.still bug is pidding. My project settings are proper
for run time library.
|| ART OF LIVING ||
|
|
|
|
|
Do you still get the error if you declare your thread proc before the call to AfxBeginThread()?
UINT Myfunc(LPVOID pParam);
void CCustom1Dlg::OnButton1()
{
// TODO: Add your control notification handler code here
int m = 5;
CWinThread* tt;
tt = AfxBeginThread(Myfunc,&m,THREAD_PRIORITY_NORMAL,0,0,NULL);
}
UINT Myfunc(LPVOID pParam)
{
int* co = reinterpret_cast(pParam);
return 0;
}
*edit* You don't want to pass &m to your thread...m can/will go out of scope before MyFunc() uses<br />
it.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Looks like we posted a response at the same time
|
|
|
|
|
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Sorry,delayed responce,
If I made variable global ,written function declaration,where you shown but error is very same. No Change.
|| ART OF LIVING ||
|
|
|
|
|
From your posts below, it looks like you fixed it, right?
You'll still have to make sure any variables pointed to by a pointer passed to another thread
stay in existence until all threads that use the variable are done using it!
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
yes that was another mistake
|| ART OF LIVING ||
|
|
|
|
|
Give this a try: (note the placement of the Myfunc function declaration before OnButton1 handler and note the use of the _cdecl modifier)
Hope this helps
//------------------------------------------
UINT _cdecl Myfunc(LPVOID pParam);
void CCustom1Dlg::OnButton1()
{
// TODO: Add your control notification handler code here
int m = 5;
CWinThread* tt;
tt = AfxBeginThread(Myfunc,&m,THREAD_PRIORITY_NORMAL,0,0,NULL);
}
UINT _cdecl Myfunc(LPVOID pParam)
{
int* co = reinterpret_cast(pParam);
return 0;
}
|
|
|
|
|
shivditya wrote: ...it must be
global or static,now I have global.still bug is pidding.
Did you remember to remove it from CCustom1Dlg 's header file?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Sorry man I got my silly mistake ,I declared one more void MyFunc() in .h
file. I am very very sorry for wasting all of yours important time and effort
|| ART OF LIVING ||
|
|
|
|
|
you are great
|| ART OF LIVING ||
|
|
|
|
|
Hi...
Here's another CE C++ question....
I have a list control. Items are listed in bolded red as added to the control. Once a user had addressed an item, I would like to change the text of that one item to unbolded black.
In CE C++ I can find a way to change the color of all items in the list control.
I cannot find a way to bold/unbold the text for only one line of the control list.
I also cannot find a way to change the font of the text for only one line of the control list.
Can any of this be done in Window CE C++? If it can be done how... any hint would be greatly appreciated.
|
|
|
|
|
|
Hi,
I would like to change the font and size of text in static text...
I have been able to change color. here are the command lines I use to do that.
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(0, 0, 255));//blue
But have not found a say to set the font or font size. Is it possible to set the font size and color for a static text control in MS CE C++ (v4.0)? If it is can anyone give me a hint of how to do this?
Thanks
-- modified at 12:27 Thursday 7th June, 2007
|
|
|
|
|
Two steps are needed. First you need a font, or in the case of MFC a CFont. Then you need to select that font into the DeviceContext you already have a pointer to, pDC, before the static gets drawn. I guess in the same place as you put SetTextColor, the WM_PAINT handler.
I Can't remember off the top of my head whether you call a function on the DC pDC->SelectObject(myFont) or if you can do it the other way around myFont.Select(pDC) but you'll figure that out in no time.
Remember to record the previously selected Font which will get returned when you do the SelectObject and re-select that one back into your DC after you've finished painting or you might screw up the next guys control by drawing it with your font
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Thanks for your quick reply. Between you response and the one from Anurag Gandhi think I have the changing to static text fonts handled.
As you suggested I have a lot of studying to do on these topics. I've been developing in the UNIX/LINUX environments for years. Now they throw a an MS CE C++ project on me and want it done yesterday!!!!
I welcome the chance to learn but it’s a challenge.
Thanks!!
|
|
|
|
|
To change the font face, size, weight and other properties, Create a new font and attach it with your Device context.
use following code:
CFont font;
font.CreateFont(20,0,0,0,200,0,0,0,0,0,0,0,0,_T("Times New Roman"));
pDC->SelectObject(&font);
//First parameter is Height and 2nd is width. when 0 is passed, it takes proportionate height or width.
Now you will be able to change the font size. I will suggest read more about fonts in VC++ from any tutorial.
Anurag Gandhi.
|
|
|
|
|
Wow thanks Anurag Gandhi. I added your suggestion to by code and it ran just great!!!
As you suggested I have a lot of studying to do on these topics. I've been developing in the UNIX/LINUX environments for years. Now they throw a an MS CE C++ project on me and want it done yesterday!!!!
I welcome the chance to learn but it’s a challenge.
Thanks!!
|
|
|
|
|
I have a bunch of button resources that I want to set to be visible depending on certain criteria.
Here is a sample of the code I have:
for(i=0; i<number of sub entities; i++)
{
//for check button
pBtn=GetDlgItem(IDC_STRIPVIEW_DEVICE_1_CHECK_BTN);
pBtn->ShowWindow(SW_SHOWNORMAL);
}
I to be able to have the number in the IDC identifier change correspond to i.
How do I get the number in the IDC to be variable. Or how can I make MFC
treat a string as a resource id?
Thanks
Adam
|
|
|
|
|
Can you make the IDs consecutive and use i as an offset from the first ID?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I don't think I would be able to do that, but I can make a CString that says, for example IDC_STRIPVIEW_DEVICE_3_CHECK_BTN when i=3, but all I need to know how to do is pass that to string to the GetDlgItem function and have it accept it as an unsigned integer resource id.
Adam
|
|
|
|
|
GetDlgItem expects an integer ID. You could map indexes to an array of strings but that just
adds an unnecessary level of indirection since you'd need to convert that string back to an int
to call GetDlgItem. So, you might as well use i to index an array of actual control IDs
(integers).
That brings me back to what I was thinking...
#define IDC_BUTTON1 1000
#define IDC_BUTTON2 1001
#define IDC_BUTTON3 1002
#define IDC_BUTTON4 1003
#define IDC_BUTTON5 1004
#define IDC_BUTTON6 1005
...
for(i=0; i<number of sub entities; i++)
{
pBtn=GetDlgItem(i + BUTTON1);
pBtn->ShowWindow(SW_SHOWNORMAL);
}
-or-
for(i=IDC_BUTTON1; i<IDC_BUTTON6; i++)
{
pBtn=GetDlgItem(i);
pBtn->ShowWindow(SW_SHOWNORMAL);
}
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hello,
Suppose I have a dll called MyDLL.dll which is statically linked to External.dll . Now I load MyDLL.dll from my application like this:
handle = LoadLibrary("MyDLL.dll");
Now, if MyDLL.dll and External.dll are present everything works just fine and LoadLibrary succeeds (i.e. handle != 0).
When I delete External.dll, then I get this behaviour:
a) In debug mode an error message box pops up saying that External.dll was not found.
b) In release mode I don't get this error message box. handle is simply 0. So I call GetLastError() along with FormatMessage() and get an error code of 126 (specified module not found).
Ideally, I'd like to suppress the message box in a) and get its message string so I can write a more detailed description of the problem into the log. I thought GetLastError() and FormatMessage() would take care of this, but apparently they only return some hardcoded standard messages.
So my primary question is whether there is a way to get this message string somehow?
If there is no way to get the message string, I'd like b) to always display the error message box. According to the MSDN docs ( http://msdn2.microsoft.com/en-us/library/ms680621.aspx ) I need to call something like SetErrorMode(0) ( maybe something like SetErrorMode( SetErrorMode(0) | ~SEM_FAILCRITICALERRORS) ).
This call does not seem to have any effect. The current error mode is 4 ( == SEM_NOALIGNMENTFAULTEXCEPT), but the error message box still does not pop up, it keeps failing silently (handle == 0).
Can somebody help me?
|
|
|
|
|
Nitrogenycs wrote: I thought GetLastError() and FormatMessage() would take care of this, but apparently they only return some hardcoded standard messages.
So my primary question is whether there is a way to get this message string somehow?
If FormatMessage gives you the error string, then I am confused on what other message string you desire to obtain?
|
|
|
|