|
To be honest: I don't know. But I assume that if you call GetCurrentDirectory dierctly after startup it will return the path where your app is located. But I still think it is safer to use GetModuleFileName.
/edit: Tim is right
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
When I rotate a transparent bitmap, the transparent background color will be drawn around the bitmap (a one pixel halo). This doesn't happen when the rotation is horizontal or vertical. I am doing the following masking:
BitBlt( hScreenDC, r.left, r.top, curWidth, curHeight, hMemoryDC, 0, 0, SRCINVERT );
BitBlt( hScreenDC, r.left, r.top, curWidth, curHeight, hMaskDC, 0, 0, SRCAND );
BitBlt( hScreenDC, r.left, r.top, curWidth, curHeight, hMemoryDC, 0, 0, SRCINVERT );
At this point I have no clue as to why something like this would occur, because I have rotated the whole bitmap and saved it into the DC's. Has this happened to anyone before?
Thanks!
|
|
|
|
|
Sounds like your rotation code is causing your mask to degrade, so that the transparent colour where it is next to another colour is slightly changed. Have you verified that the pixels in question are EXACTLY the background colour, and not off by one or two ?
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Can anyone tell me this?
I have a window that contains 4 to 5 property pages so the user can click on the tab on the top and change different things on each one. When the user hits OK, there are checks to validate some of the changes. If one of the validations fails, I want to go to the edit box that contains the information. But that edit box might not be on the property page the user is currently on. I have an error message saying what is invalid. But is there any way, after displaying the error message, to set the focus to the edit box on a different property page? I hope all of this is making sense.
In summary, I just want to be able to set focus on a control that might be on a different page than the one the user was on when he/she hit OK. Is there anyway to do this. Currently, it is setup using the Win32 SDK using PROPSHEETPAGE and PROPSHEETHEADER. No MFC used.
|
|
|
|
|
Try using PropSheet_SetCurSel. This function is simple to use, if you know the page handle or the index. For example, say your control is on the 3rd page out of 4 pages. The function would be:
PropSheet_SetCurSel(GetParent(hDialog), NULL, 2);
Then set the focus on your control. If you know the page and choose to use it, just replace NULL with the page handle...
|
|
|
|
|
Deleting intermediate files and output files for project 'VisiBounce - Win32 Debug'.
--------------------Configuration: VisiBounce - Win32 Debug--------------------
Compiling resources...
Compiling...
StdAfx.cpp
Compiling...
VisiBounce.cpp
VisiBounceDlg.cpp
FileInfo.cpp
Generating Code...
Linking...
VisiBounceDlg.obj : error LNK2001: unresolved external symbol _BBBOUNCECHECK@20
Debug/VisiBounce.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
VisiBounce.exe - 2 error(s), 0 warning(s)
anyone know this compilation error, and maybe can suggest what i did wrong?
todo....
:: insert inpirational text here ::
|
|
|
|
|
ah hahhh, I got it , for those who want to know, it was that the compiler was not finding the Library (.lib) file for my .dll ! I dropped the .lib file in the project directory, project / settings / link -> .lib file,
0 errors, 0 warnings
woohoo!
todo....
:: insert inpirational text here ::
|
|
|
|
|
And it appears it took you less than 7 minutes
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Google is a beautiful thing!
todo....
:: insert inpirational text here ::
|
|
|
|
|
Where and how do I make changes to how MFC opens a recent file when the user selects one from the menu?
|
|
|
|
|
|
Hi guys!
I'm a beginner and I just want to know how to change the background color of a MDI (without doc/view)app. There's a lot of exemples out there, but they are for dialog based app.
Also, I have some other problems. I'm not able to change the icon and title of my child windows.
I tried:
BOOL OpenGL_ContextMFC::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying the CREATESTRUCT cs
if( !CMDIChildWnd::PreCreateWindow(cs) )
return FALSE;
cs.lpszName = "My child window name";//change my name here
cs.cx = 500;
cs.cy = 500;
cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
cs.lpszClass = AfxRegisterWndClass(0);
return TRUE;
}
I can change the height and width of the windows but not the name.
Any ideas?
Thanks!
|
|
|
|
|
About your first problem:I'm sure there is an article in this site that discribe it,but I can't remember where was it.Search here,you can find it.
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
I found it:
http://www.codeproject.com/dialog/mdibackgroundimage.asp
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
Hello everybody, i am trying to parse a simple CSV file (see a little file sample below) using the functions found in the book 'PROFESSIONAL MFC with VC++6' by M. Blaszczak, Wrox. I am working with VC7.
The functions work fine but unfortunately i can get only the first, say, N-1 values parsed instead of all the N wished ones.
for example in the sample below
i get parsed only:
label0 .. label5 as labels row (missing label6)
field0,f1,f2,f3,f4,f5 as first row of values (missing field f6)
0,10,20,30,40,50 as second row of values (missing 60)
and so on...
I mean only six values (with reference to the csv file sample), not all the seven values
any help/tip will be gratly appreciated!
Thanks in advance
<br />
class CMyDoc : public CDocument<br />
{<br />
<br />
public:<br />
int CountChars(CString& ref, TCHAR ch = ',') const;<br />
CString GetField(CString& ref, int nIndex, TCHAR ch = ',') const;<br />
<br />
...<br />
<br />
<br />
};<br />
<br />
...<br />
<br />
int CMyDoc::CountChars(CString& ref, TCHAR ch) const<br />
{<br />
LPCTSTR pstrBuffer = ref.LockBuffer();<br />
int nCount = 0;<br />
<br />
while (*pstrBuffer != _T('\0'))<br />
{<br />
if (*pstrBuffer == ch)<br />
nCount++;<br />
pstrBuffer++;<br />
}<br />
<br />
ref.UnlockBuffer();<br />
return nCount;<br />
}<br />
<br />
<br />
CString CMyDoc::GetField(CString& ref, int nIndex, TCHAR ch) const<br />
<br />
<br />
{<br />
CString strReturn;<br />
LPCTSTR pstrStart = ref.LockBuffer();<br />
LPCTSTR pstrBuffer = pstrStart;<br />
int nCurrent = 0;<br />
int nStart = 0;<br />
int nEnd = 0;<br />
int nOldStart = 0;<br />
<br />
while (nCurrent <= nIndex && *pstrBuffer != _T('\0'))<br />
{<br />
<br />
if (*pstrBuffer == ch)<br />
{<br />
nOldStart = nStart;<br />
nStart = nEnd+1;<br />
<br />
nCurrent++;<br />
}<br />
<br />
<br />
nEnd++;<br />
pstrBuffer++;<br />
}<br />
<br />
ref.UnlockBuffer();<br />
<br />
<br />
if (*pstrBuffer == _T('\0'))<br />
{<br />
TRACE("Warning: Couldn't find it.\n");<br />
return strReturn;<br />
}<br />
<br />
return ref.Mid(nOldStart, nEnd-nOldStart-1);<br />
}<br />
<br />
<br />
<br />
...<br />
<br />
<br />
...<br />
<br />
int nColumns = pDoc->CountChars(pDoc->m_strColumns);<br />
TRACE("N. col= %d, header titles= %s\n", nColumns, pDoc->m_strColumns);<br />
int nIndex;<br />
CString strCurrent;<br />
for (nIndex = 0; nIndex < nColumns; nIndex++)<br />
{<br />
... print values ...<br />
}<br />
SAMPLE FILE.CSV
label0,label1,label2,label3,label4,label5,label6 <-- labels row
field0,f1,f2,f3,f4,f5,f6 <-- first row of values
0,10,20,30,40,50,60 <-- second row of values
...
best regards
|
|
|
|
|
Try my article, CDataFile[^] Just change the std::vector<<double> values="" to="" std::vector<cstring>="" and="" comment="" out="" the="" statistics="" stuff="" you'll="" be="" good="" go.=""
<b="">- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
my message was truncated
Anyway, change the double vector to CString and scrap the statistics stuff and you'll be good to go.
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
thank you very much Nitron!
i have just downloaded your excellent code and i'll give it a try as soon as possible
anyway i would be really interested in finding the reasons why the code above form Wrox book doesn't work as expected
I have tried to debug it and follow all the steps to figure out why the last field isn't parsed but so far i could'f find an answer so i would appreciate very much if anybody could point me towards the solution
thanks again!
best regards
|
|
|
|
|
Hello world...
I use a grabber with 4 cameras connected and I get images from this 4 cameras.
Next, I display all images in the same View...
My question is simple:
Is the Document OR the View which must acquire the images?
I suppose It's the Document... Because the Data is the image and the view only display the data...
When I press the start menu (to start the acquisition) is the Document or the View which must handle this message?
Thanks in advance...
Hello World!!!
from Raphaël
|
|
|
|
|
Raphaël Kindt wrote:
I use a grabber with 4 cameras connected and I get images from this 4 cameras.
Got any spare cameras you don't need? I'm taking donations.
Raphaël Kindt wrote:
When I press the start menu (to start the acquisition) is the Document or the View which must handle this message?
My instinct tells me it's the Document that needs to handle this. But I imagine you also want to update the view as the acquisition is in progress. So as you're loading the images, call UpdateAllViews to let the views know of the new data that has come in.
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
You are right. From an architectural point of view its the Document that should get the images. The purpose of the view should be restricted to display and of course user interface.
Raphaël Kindt wrote:
When I press the start menu (to start the acquisition) is the Document or the View which must handle this message?
This is potentially more interesting a question It really depends on the kind of system you are building. Ideally the document will have a fucntion that will tell it to go and acquire the images.
Now in one situation you can have the menu send its command to the view which will tell the document to load the images.
In another case you could have the menu send a message to the view which will load the document which already has the images loaded because some other process told it to do so, or because the document is told to load images every so often.
Another case, where there is no menu, when the document finds images the view turns on.
Not sure if I actually answered the second question
|
|
|
|
|
Raphaël Kindt wrote:
When I press the start menu (to start the acquisition) is the Document or the View which must handle this message
IMHO it's the MainFrame which should process the command. Knowing which document is currently active, it will be able to call for this object the document's method responsible for loading the data.
HTH,
K.
Angels banished from heaven have no choice but to become demons
Cowboy Bebop
|
|
|
|
|
I think that's a good idea...
Thanks Karl...
Hello World!!!
from Raphaël
|
|
|
|
|
I wonder if there is an easy way to rename a class
including its source file in Visual Studio.
Has .NET Studio any support for this ?
Variable renaming would also be a fine thing.
Simply change the name in the class wizard and all
occurences of the variable are renamed.
This would make refactoring the code much easier when
I change my code in the late stage of a project to
clean up loose ends.
Regards,
Alois Kraus
|
|
|
|
|
Edit->Find and Replace->Replace in Files
Check out the regular expression you pretty much can do anything old grep used to do.
|
|
|
|
|