|
|
I've also written code to extract info from .DSP and .DSW files (with Neville's help no less!). My code extracts the files and some of the compiler settings from the .DSP, and extracts the projects from the .DSW.
The code is on CP, in the following article:
http://www.codeproject.com/useritems/includefinder.asp[^]
If you download the source, the files you are interested in are VC6Objects.cpp/h and DSObjects.cpp/h.
Chris Richardson
|
|
|
|
|
Hi,
I wanted to add 'code' into the .DSP file.
I have set an environment variable with text in it ("mylib.lib test2.lib" etc) in it, and i want it to be added in the include list of libs in the project.
Any ideas?
Best regards,
Jens
|
|
|
|
|
Aaarrrggghhh. Recently, some users have been reporting problems with one of my massive MFC apps. Turns out it is leaking 6 HRGN handles everytime a new top-level window is opened (the program uses LOTS of CFrameWnd-derived top-level windows). Over the course of a day, some users are getting thousands of GDI handles leaked. Not good.
After much head scratching and some assistance from Google Groups, I tracked this down to a bug in Windows XP.
http://support.microsoft.com/?kbid=319740
Guess what? MS fixed this bug in XP SP1, but they have REINTRODUCED IT IN SP2!!!! Most of the XP users in our company have already upgraded to Service Pack 2 now too. Sob.
Sigh. So my users have to revert back to "Classic" mode to workaround this problem (no bad thing you might say!) which they are none too pleased about.
And, of course, as this is an MFC-specific issue, they think it is *my* fault as "other apps run fine".
I am praying for MS to release a hotfix but have no idea how I can escalate such a problem.
So fellow CPians - be warned - this bug may be affecting your MFC apps right now...
"May the seed of your loin be fruitful in the belly of your woman"
|
|
|
|
|
What a PITA. I wonder if it is possible to use the XP SP1 Uxtheme.dll mentioned in the KB.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
I'm too chicken to try it! Sigh. The grief I am getting because of this bug...
"May the seed of your loin be fruitful in the belly of your woman"
|
|
|
|
|
|
Hello !
I would like to produce random numbers between 0 and 15. I tried to use srand and rand. So I used a similar code:
#define RAND_MAX 15 //Outside of the function<br />
srand(1);<br />
int Random = rand();<br />
But the numbers are greater than 15
How can I do that ?
Thanks
|
|
|
|
|
Just #defining your own RAND_MAX is no good. The rand() method uses the RAND_MAX that was defined when the library it was in was compiled. To get it into a particular range try something like:
int Random = rand()*(15/RAND_MAX);
The other thing to note is that if you always seed the random number generator with the same number (1 in your example), it will always generate the same sequence of pseudorandom numbers. Try something like:
srand( (unsigned)time( NULL ) );<br />
This seends the generator with a value based on the current time so it should give you different sequences.
Mike
|
|
|
|
|
Thanks
|
|
|
|
|
To produce random numbers from 0 to some predefined limit it would probably be easiest to do:
#define RAND_MAX_LIMIT 15 // Set 15 as limit for randomly generated values
srand((unsigned)time(NULL)); // Seed random number generator with current time
int Random = rand() % (RAND_MAX_LIMIT + 1); // Only generate numbers between 0 and your predefined limit
|
|
|
|
|
cedric moonen wrote:
I would like to produce random numbers between 0 and 15.
Try rand() % 16 .
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi Folks,
I am searching a listbox similar to the "favorits" list in IE6. A List with buttons or hyperlinks whitch I can dynamically add and remove. I need it for a MFC-App.
Sorry, don`t have time to write it myselfe...
Anybody knows something??
Thanks, Hardy.
|
|
|
|
|
How can I transmit a xml's datas to multi-listview?TKS!give me some sourcecodes pls.tks!
|
|
|
|
|
Hello,
Quick question...
I have CDialog derived dialog and in it I start a timer in the OnInitDialog with a specific ID. I never kill that timer though when leaving the dialog.
Does anybody know if this might build up resources calling the SetTimer multiple times(with same ID!!!) without specifically killing it ever.
Does the Timer get killed when the dialog object goes out of scope?
Thx for any light on this subject..
Greetz,
Davy
|
|
|
|
|
I believe calling SetTimer multiple times will create multiple system timers, even if you call it with the same ID. The id is the value the timer returns to you when it ticks. This is different to the timer identifier which is the value returned by SetTimer.
The timer will not get killed when the dialog goes out of scope, you need to call KillTimer with the value returned by SetTime.
Mike
|
|
|
|
|
Timers are a limited system-wide resource, meaning that they can run out.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I find the VS help to be a little vague on this method, does SuspendThread halt execution of a thread -immediately-? And what if the thread contains some no-user-mode code? Can I use it to decently halt a thread before calling TerminateThread to brutally kill it?
PS: I'm using TerminateThread because in one of my threads I'm calling into a function of a third-party lib (out of my control) that sometimes hangs. TerminateThread seems the only option left to stop the hanging (now threaded) function and retain control over application execution.
|
|
|
|
|
|
Hi,
I am working with CListCtrl in VC++ where I tried to implemnt the multi-selection of Items by
1) SHIFT+ Mouse click
2) SHIFT+ Arrow Key selection
I could implement these with NM_CLICK and ITEMCHANGED respectivly,
but gives inconsistant selected items.
Plse anybdy to solve this situation by tech advice/code snippet
Thanks,
Krishna
Krishnakumar
|
|
|
|
|
If the default multi selection works for you, then just turn off the single selection style:
m_YourListControl.ModifyStyle( LVS_SINGLESEL, 0 );
If that's not what you're after, sorry.
Chris Richardson
|
|
|
|
|
Hi, Thanks for reply.But I need the ListCtrl as multi-selection and I made it multiselection type.
It visually selects the multiple items too. But the problem is that when I tried to delete these items the count is inconsistant.
Krishna
Krishnakumar
|
|
|
|
|
m makeing ATL DLL using ATL COM Wizard
i m getting an error as follows
F:\rough work\atl2\atl2.idl(18) : error MIDL2025 : syntax error : expecting a type specification near "CString"
for the line given below
[id(1), helpstring("method Connect")] HRESULT Connect(CString ip , int port);
how can i remove the eror
thanx
Regards.
|
|
|
|
|
I actually had previously used it to do console applications on Visual C++ but never used MFC before. I had a problem; I was told to set a 4 by 4 area by using Matrix in MFC coding and use it to check whether the image has any little "black spots". If it does, I have to set these small little "black spots" of the image from "255" or anything else to zero. The codings must be in a function.
So How do I do it?
Pls do kindly reply. I needed this asap. Thanks!
Below are the codes: (the codes have quite a bit of a problem...)
<br />
void CMediVisionView::MatrixImage()<br />
{<br />
int i;<br />
<br />
if(no_of_rows==512){<br />
for(i=0; i<512-5; i++)<br />
{<br />
if (image512[i]==0 && image512[i+1]==0 && image512[i+2]==0 && image512[i+3]==0 && image512[i+4]==0){<br />
<br />
if(image512[i]==0 && image512[i+512]==0 && image512[i+(512*2)]==0 && image512[i+(512*3)]==0){<br />
<br />
if(image512[i+4]==0 && image512[i+512+4]==0 && image512[i+(512*2)+4]==0 && image512[i+(512*3)+4]==0){<br />
<br />
if(image512[i+(512*3)+1]==0 && image512[i+(512*3)+2]==0 && image512[i+(512*3)+3]==0 && image512[i+(512*3)+4]==0){<br />
<br />
image512[i+512+1]=0;<br />
image512[i+(512*2)+1]=0;<br />
image512[i+(512*3)+1]=0;<br />
<br />
image512[i+512+2]=0;<br />
image512[i+(512*2)+2]=0;<br />
image512[i+(512*3)+2]=0;<br />
<br />
image512[i+512+3]=0;<br />
image512[i+(512*2)+3]=0;<br />
image512[i+(512*3)+3]=0;<br />
}<br />
<br />
}<br />
}<br />
<br />
}<br />
<br />
}<br />
}<br />
<br />
<br />
<br />
}<br />
|
|
|
|
|
i have a msflexigrid, works great, but i am wondering how to let the user click on a cell and copy the data inside of the cell (not edit the cell, just copy the data inside of the cell) ... any ideas?
|
|
|
|