|
|
Stick^ wrote: it never works
Can you provide some detail?
/ravi
|
|
|
|
|
I will try, but not likely to be helpful to you.
I make add-on aircraft and avionics gauges for MS Flight Simulator.
The "gauges" are made with an SDK supplied by MS, and compile into .dll's. However, they are not tru .dll's from what I understand. In any case, the "gauges" (multiple in one file) appear fine in my aircraft on MSFS, and he just gets a blank panel.
I made a version in which I turned off the protection code to see if perhaps the call to get verify the license key is maybe the issue as he is on XP Pro, and someone else suggested that I compile with "multi-threaded" vs. multithreaded dll as some new runtimes in an update from MS on the game has new runtimes in it. So, I will try that and see what happens too.
I am just ready to pull out my hair. But, this is my own fault for not actually going to school for this and learning the proper way, haha.
My problem is I barely understand what I'm doing sometimes. C++ is no problem, but Windows is way over my head. =)
Patrick
|
|
|
|
|
Can you more explain and some detail of your program?
|
|
|
|
|
Hi,
Yes, but I think the problem may be solved now.
http://i91.photobucket.com/albums/k282/Benchmark_Avionics/Properties.png[^]
Someone informed me that a recent change in the game program included some libraries that require now that we statically link the program. So, I have recompiled and will not test this in the morning.
Thanks guys for your ideas. I'll let you know if this was the problem for everyone's future reference.
As I am using MS DirectInput and DirectSound in this project, I was worred it had to do with DirectX, but seems it has to do with the recent game update.
|
|
|
|
|
Glad you found the answer.
|
|
|
|
|
Sorry for my poor English.
Is it the issue of debug version and release version ?
|
|
|
|
|
No, we tested that, but it may be solved now. (See above).
|
|
|
|
|
Hi,
How to restrict the number of objects created for a class??
Thanks
Today is a gift, that's why it is called the present.
|
|
|
|
|
It is hard to know with such a general description - do you have more details?
Basically I guess you have to count them, you could have a static int member of the class, initialised to zero, that you increment in all constructors, and when you reach a limit you do something like throwing an exception.
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
cp9876 wrote: you do something like throwing an exception.
Only if there is no other solution which would almost never be the case.
led mike
|
|
|
|
|
That's why I like code project - I learn things! Putting this sort of functionality in some sort of factory is a much better idea.
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
Do some research on reference counting and factory patterns
led mike
|
|
|
|
|
narayanagvs wrote: How to restrict the number of objects created for a class??
- Make the constructor private.
- Add a static factory method (eg:
CreateInstance() ) to the class. The method should count the number of instances served up and use this value to control the behavior of the CreateInstance() method.
- In the object's destructor, decrement the instance count (held as a static member).
/ravi
|
|
|
|
|
THis issue is addressed by the singleton design pattern (yes, despite of the name, the singleton can also allow more than one instance of the related object). You can find a complete reference of the signleton in the following book: Design Patterns: Elements of Reusable Object-Oriented Software [^].
BTW you can also find some singleton related stuff on google.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
hi.
I have a MDI program done in CFormView which have a scrollbar control. when I minimize the child window and use the scrollbar of the child window, the scrollbar control in the CFormView follows the scrollbar of the child window.
How can I the make the scrollbar control independent of the scrollbar of the child window?
Thank you.
|
|
|
|
|
Hi,
are you setting the parent of the second control bar to the child window?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
hi.
control bar refers to toolbars, status bars, dialog bars and rebars?
Im don't use any of them. I only have menu.
|
|
|
|
|
Hello,
Can someone please tell me how to convert from CString to const* char?
I used the following from msdn website:
<br />
const size_t newsize = 100;<br />
char nstring[newsize];<br />
strcpy_s(nstring, orig);<br />
strcat_s(nstring, " (char *)");<br />
cout << nstring << endl;
But it requires that I compile with clr. When I do that, my classx.cpp (all my class function) are considered errors.
When I don't modify the property of my solution to clr, I still get two errors:
fatal error C1190: managed targeted code requires a '/clr' option
Is there any other way to convert without using clr?
Thank you.
--Star
|
|
|
|
|
This is not clr code, I can't imagine how it gives you this error.
The CString class has a GetBuffer method that returns a char *. Not sure if it is char or TCHAR, but so long as you're not building Unicode, they are the same.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
Why dont you use the "strcpy" and "strcat" respectivily instead of using "strcpy_s" and "strcat_s". Since the later 2 functions have more securuty enchancements you problem could be related with that.
Manoj
Never Give up
|
|
|
|
|
manojkumarrai wrote: Why dont you use the "strcpy" and "strcat" respectivily instead of using "strcpy_s" and "strcat_s".
I guess, one should always use enhanced versions of functions. Isn't it ?
manojkumarrai wrote: have more securuty enchancements you problem could be related with that.
.
How could be that ?
Prasad
MS MVP - VC++
|
|
|
|
|
In addition to previous reply, have a look at CString::operator LPCTSTR .
Again, it depends on project settings.
Prasad
MS MVP - VC++
|
|
|
|
|
HELP! Caption bar buttons don't work on XP display. The minimize/restore/close buttons appear very big on XP and hence when you click on the upper left corner of the minimize button on XP, nothing happens. YOu have to move the mouse the lower right corner of the minimize button to get it to work. Could someone please tell me what i need to do to get the captionbar buttons to work on XP display. Thanx in advance.
////////////////
// Draw min, max/restore, close buttons.
// Returns total width of buttons drawn.
//
int CCaptionPainter:rawButtons(const PAINTCAP& pc)
{
ASSERT(m_pWndHooked);
CWnd& wnd = *m_pWndHooked;
DWORD dwStyle = wnd.GetStyle();
if (!(dwStyle & WS_CAPTION))
return 0;
ASSERT(pc.m_pDC);
CDC& dc = *pc.m_pDC;
int cxIcon = GetSystemMetrics(SM_CXSIZE);
int cyIcon = GetSystemMetrics(SM_CYSIZE);
// Draw caption buttons. These are all drawn inside a rectangle
// of dimensions SM_CXSIZE by SM_CYSIZE
CRect rc(0, 0, cxIcon, cyIcon);
rc += CPoint(pc.m_szCaption.cx-cxIcon, 0); // move right
// Close box has a 2 pixel border on all sides but left, which is zero
rc.DeflateRect(0,2);
rc.right -= 2;
dc.DrawFrameControl(&rc, DFC_CAPTION, DFCS_CAPTIONCLOSE);
// Max/restore button is like close box; just shift rectangle left
// Also does help button, if any.
BOOL bMaxBox = dwStyle & WS_MAXIMIZEBOX;
if (bMaxBox || (wnd.GetExStyle() & WS_EX_CONTEXTHELP)) {
rc -= CPoint(cxIcon, 0);
dc.DrawFrameControl(&rc, DFC_CAPTION,
bMaxBox ? (wnd.IsZoomed() ? DFCS_CAPTIONRESTORE : DFCS_CAPTIONMAX) :
DFCS_CAPTIONHELP);
}
// Minimize button has 2 pixel border on all sides but right.
if (dwStyle & WS_MINIMIZEBOX) {
rc -= CPoint(cxIcon-2,0);
dc.DrawFrameControl(&rc, DFC_CAPTION, DFCS_CAPTIONMIN);
}
return pc.m_szCaption.cx - rc.left - 2;
}
|
|
|
|
|