|
|
make it like this:
for (int i=0; i<=10000000000000; i++) {
j += i;
if( bStop )
break;
}
...
void Stop()
{
bStop = TRUE;
}
AND: i is an integer number, so 10000000000000 IS INVALID for int!!! (too big)
Don't try it, just do it!
|
|
|
|
|
I embeded the matlab program(symbolic equation) into visual studio 6.0
with MATLAB Add-in. Unfortunately, they can't compile the matlab code.
following is the error message
The MATLAB Compiler does not currently support MATLAB object-oriented programming. References to the method "sym" will produce a run-time error.
Please help me.
dong wook lee
|
|
|
|
|
My ower draw button doesn't show the tooltip in dll, but
it works fine in exe files.
What is it happened? My DLL is regular with staticly
linked. And my dialog is pop up as modeless dialog.
In modeless dialog , PretranslateMessage is not getting called.
I'm Bird~
|
|
|
|
|
I don't know who the webmaster here is, but great site. On mine, I added a script into the message board (a hack) that numbered lines of code. I think it could be useful here as well.
Josh
|
|
|
|
|
|
I used MFC wizzard to create a mdi application. I have the common app.cpp view.cpp doc.cpp mainfraim.cpp and child.cpp along with a hundred add ons. I couldn't find a good File new template chooser so I am making one from scratch. I am at the point where the user presses OK, on the type he wants. I simply want to open from a read only file, like a template I create. Kinda like if I were to click File Open. I wasn't sure how to do this, so I looked at how the application was set up to open a file. All it has is:
BOOL CFDPDoc::OnOpenDocument(LPCTSTR lpszPathName) <br />
{ if (!CDocument::OnOpenDocument(lpszPathName))<br />
return FALSE;<br />
return TRUE;<br />
}
Well, that is the only real code that it has on File open, I just want to make a similar instance to open only that template I will make. How do I do that? thanks guys
LOSTTWARE.com
|
|
|
|
|
Well, I really need someones help on this. Basically all I want to do is make a function that instead of opens a file that the user chooses, I can right the file it opens into that function. How do I write a function that does that with my MDI application?
Josh
|
|
|
|
|
So you need a function that instead of opening the file a user chooses, it opens the file stream into a function ?
Easy, just override the necessary message (ID_FILE_NEW or a custom message), create a CFile object, use it to open the designated file (OPENFILENAME struct) and off you go. You can now use the object to read/write data from the attached file.
Is this what you want ? If not, you'd need to write a bit more clearer on what you need accomplishing. Remember to check your posts before posting them. Make sure they have no grammar or word bugs in them, so they are easy to understand. Misunderstanding issues are a huge problem in this field
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
If I understand correctly you have many CDocTemplate objects registered in your application, and you want to open a specific document type?
You can do that by getting a pointer to the correct CDocTemplate object and calling OpenDocumentFile() on it. Pass NULL to open an empty document, or pass a filename if you need to open an existing file.
If you need to do this from an existing open document and need to open the same type of document, you can call GetDocTemplate(0 to get the CDocTemplate pointer you need. If not, then you need to acquire a pointer to it through the CWinApp:m_pDocManager pointer. You can iterate the list of CDocTemplate objects using GetFirstDocTemplatePosition() and GetNextDocTemplate(). When you find the right one (if you know which one it is) you can proceed from there.
This article of mine may also be of help:
Doc/View stuff[^]
Roger Allen - Sonork 100.10016
If your dead and reading this, then you have no life!
|
|
|
|
|
Hi,
I am working on a project that needs Arabic and Hebrew support and my dialogs have to be mirrored in a right-to-left layout. I have already implemented this using WS_EX_LAYOUTRTL in the rc files and it works fine in WinXP, Win2k, and WinME. I tried this in Win98 however it doesn't work. But if a CFileDialog class is used directly, the mirroring displays correctly.
Is there a limitation for Windows 98 with regards to mirroring CFileDialog derived dialogs, or do I need to code a lot more besides WS_EX_LAYOUTRTL?
Thanks,
Eriol41
|
|
|
|
|
Hi,
I am using the CDataGrid to display some information from a
database. I am having the following problems.
1. I am supposed to trap errors and print them in to a log file. I have mapped the Error message of the data control. The function looks like this:
OnErrorAdodc1(long ErrorNumber, BSTR FAR* Description, long Scode, LPCTSTR Source, LPCTSTR HelpFile, long HelpContext, BOOL FAR* fCancelDisplay)
I have not been able to get the Description text from BSTR FAR* ptr. Can someone help me there.
2. Is it possible to find the sum of an entire column and print it below the column. I know how to find the summation. But don't know if I can set in a column of the data grid some information that does not belong in the database.
My problem is I cannot find help on usage of the data grid/ control. Can you tell me if there is any documentation on them.
Really appreciate your help.
Thanks.
|
|
|
|
|
If Windows starts my screensaver, when the screensaver stops running, child processes stop running as well!
Why I'm starting a child process in my screensaver is another story(it's not a virus or anything).
If I start the screensaver myself by double clicking on it, when it stops running its child process remains running.
Any ideas? I'm guessing it's a security feature, but I'd like to get around it if possible.
Thanks!
Todd
|
|
|
|
|
I am trying to display a CDialog derived class froma dll using COM. The COM stuff is working. It seems that my dialog is failing to create its own m_hWnd:
void __stdcall CMattDlgCmpnt::HtmlMsgBox( HWND wndParent, BSTR strmsg )<br />
{<br />
CWnd* pWnd = new CWnd();<br />
pWnd = CWnd::FromHandle(wndParent);<br />
<br />
CNormalDlg *wndNormalDlg = new CNormalDlg( pWnd );<br />
wndNormalDlg->DoModal();<br />
}
Debugging yields the following:
{CNormalDlg hWnd=0x00000000}
I tried doing this as well:
CNormalDlg *wndNormalDlg = new CNormalDlg( pWnd );<br />
wndNormalDlg->Create(IDD_DIALOG1);<br />
wndNormalDlg->ShowWindow(SW_SHOW);
But then I get an nasty ASSERT here:
#ifdef _DEBUG<br />
if (!_AfxCheckDialogTemplate(lpszTemplateName, FALSE))<br />
{<br />
ASSERT(FALSE); <br />
PostNcDestroy();
return FALSE;<br />
}
Any ideas. Thanks.
Matt (Padawan Learner)
|
|
|
|
|
Hahahaha, i pity you man, coz you just dont know where the problem is .
dont worry i have been there too.
just add this line at the start of the CMattDlgCmpnt::HtmlMsgBox method.
AFX_MANAGE_STATE(AfxGetStaticModuleState())
if this doesnt solve ur problem, ur then on ur own.
basically MFC dialogs and COM are not a good mix. u should try to use WTL or win32 way of poping a dialog.
The world is becoming small and so are the people.
|
|
|
|
|
I want to write an application to convert the jpeg files to thumbnails. Can you tell me where to start?
Elizabeth
|
|
|
|
|
Try libjpeg. It's fairly low level so you should be able to do pretty much anything you need to do with jpegs.
Lib JPEG[^]
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
I would avoid using 3rd party software as much as possible. How difficult it is to write a function to convert a jpeg file to a thumbnail file? I also have a need to convert other image formats to a thumbnail format.
Elizabeth
|
|
|
|
|
It aint worth writing ur own code to do it, plus the jpeg decomp libs are free. Otherwise check out CxImage in codeproject.
Jesus! i am still alive.
|
|
|
|
|
It sounds very helpful. Can you tell me where I find the jpeg library file? I hope there is not much work when I deploy my application to a client machine.
Elizabeth
|
|
|
|
|
Hi there!
I'm trying to "swap" keys on the keyboard.
The main reason is that I want to swap the " with « and »
depending on wether i'm pressing the left or right shift-buttons.
The hook "triggers" whenever I press the correct keys and
a MessageBox appears (I used it for debugging purposes).
Still I have trouble with SendInput and keybd_event.
I get keybd_event to send "A"'s and "B"'s and so on, but NO « and » (ALT 174 and ALT 175) (at least on my keyboard).
It seems that the ascii values are 171 and 187 for those two chars. I've tried to "send" 171 and 187 but still no luck. Is it because the chars are so "high up" in the ascii table?
I've tried SendMessage(GetForegroundWindow(),WM_CHAR,(WPARAM)'«',0) too, with no luck.
Any suggestions anyone?
|
|
|
|
|
I'm need to resolve how to save a HBITMAP to jpeg file.
Someone try???????
// drawing somethings///////////////////////////////////
void CJanelaView::OnGravar() {
CClientDC dc(this); Graphics d(dc);
Pen blue (Color(255, 0, 0, 255));
Pen red (Color(255, 255, 0, 0));
Pen pen (Color(y, 0, 255,0));
Pen pen1 (Color(x, 255, 0, 255));
Pen pen2(Color(255, 255, 0, 255));
for (int x=0,int y=256; x<256; x+=15){ d.DrawLine(&blue,0,y,x,0); d.DrawLine(&red,256,x,y,256); y-=5; }
for (y = 0; y < 256; y++){ d.DrawLine(&pen, 0, y, 256, y); Sleep(20); }
for (x = 0; x < 256; x++){ d.DrawLine(&pen1, x, 100, x, 200); Sleep(20); }
d.DrawRectangle(&pen2,0,0,50,50); Image Im(L"lily.jpg", FALSE); d.DrawImage(&Im,50,50);
// saving the bitmap of screen view////////////////////////////////
HDC bloco = CreateCompatibleDC(dc);
HBITMAP tela = CreateCompatibleBitmap(dc,240,320);
if ( tela==0 || !SelectObject(bloco,tela) || !BitBlt(bloco,0,0,240,320,dc,0,0,SRCCOPY)) return ;
DeleteDC(bloco); DeleteDC(dc);
CLSID GifCodec;
GetCodecClsid(L"image/jpeg", &GifCodec);
tela.Save(L"wrk.jpg", &GifCodec, NULL); // an error occurs
}
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
Hi everyone,
I posted this question earlier today but i didn't get a response. I am a mini jam here, so I decided to ask it again. To the people who read my first post, SORRY!
I need to look into a UDP buffer but just peek at it. I have read that I can use MSG_PEEK with ReceiveFrom, but can I use it was Receive? I use Receive(,,MSGPEEK) with a TCP implementation and it works perfectly. How would I do this in UDP?
Here is what I have;
unsigned int temp;
int rVal = Receive(&temp, sizeof(temp), MSG_PEEK);
if(rVal < 0)
{
int err = GetLastError();
}
else
{
unsigned int RecvBuf;
int rVal2 = Receive(&RecvBuf, sizeof(RecvBuf));
...
}
Any help would be appreciated greatly. If you have code that does this, i would also appreciate that too.
Jimmy
Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)
|
|
|
|
|
NewHSKid wrote:
Just cause I am 15...
hmmm... this is a silly slogan, i'm ONLY 17, and i don't use my age for getting pity!
use recvfrom for udp, it will return you the peer's address, so you'll know where the data came from!
Don't try it, just do it!
|
|
|
|
|
No, you don't understand...
These days it works in reverse. I'm 41, have a wife, three kids and an ex-wife.
I'm the one that needs pity....
On the other hand, though, I can often answer questions sensibly in the CP forums, so it ain't all bad...
Steve S
|
|
|
|
|