|
in response to marshall:
I cant get the dialog to pop up, but i'm also not getting any errors. I am not using mfc because I would have to do workarounds to use it with scrnsave.lib, and I only want to do that as a last resort.
in response to Roger:
I have that in there but it still doesnt work.
thanks to both of you for responding.
|
|
|
|
|
changed:
char szFile[260];
to:
char szFile[MAX_PATH] = "";
and it worked
|
|
|
|
|
A while ago I came across an article on how to enable disabled controls in an application from another application. Does anyone know where the link is?
Thanks
|
|
|
|
|
Please forgive me if this is the same question several times. Maybe there is a common answer to all.
In a SDI MFC project:
I have a handler in the MainFrame class that needs to call a function in the view. How do I do this? Do I have to use a user defined message for this or is there a better way?
What about the reverse - if I want to call a function in the MainFrame class from a member function of the view?
Also calling a func in the app class from view or MainFrame.
This seems simple but I have searched in the FAQ and articles without success.
Thank you
|
|
|
|
|
For an SDI app, the main frame is simply derived from CFrameWnd, so you can call the GetActiveView() member of CFrameWnd to retrieve the current view.
The reverse is easy: there are two relevant global functions here. AfxGetApp() which returns the application object, and AfxGetMainWnd(), which returns the main window of the application (in this case, the main frame).
Dave
|
|
|
|
|
here is what i want to do:
i want to check alive(working properly) and dead(not working well) links in a website by enterig
its url and it would show search results.
|
|
|
|
|
Didnt read it myself but guess its what u need!
http://www.codeproject.com/useritems/linkchecker.asp
Papa
Murex Co.
|
|
|
|
|
I experience the following problem after I have upgraded to MDAC 2.7 RTM Refresh (Build: 2000.81.9001.00): I have a COM component and I am using ODBC API functions to do a bulk copy load (bcp_init, bcp_readfmt, bcp_exec). For some reason, bcp_exec method fails somewhere in the driver's code. In ONLY happens when my COM component is running under COM+. If I don't register the component in COM+ then everything works perfectly! Here is some stack information I am getting when it fails:
Exception: C0000005
Address: 0x1F9CD9A3
Call Stack:
SQLSRV32!SQLGetConnectAttrW + 0x80
ODBC32!MpHeapCreate + 0x7250
ODBC32!SQLGetDiagRecW + 0x2DF
ODBC32!SQLSetConnectAttrW + 0x194
ODBC32!SQLSetConnectAttrW + 0x30
odbcbcp!bcp_exec + 0x60
...
Note, everything worked fine with MDAC 2.7 RTM (Build: 2000.81.7713.00). Microsoft claim they didn't change any code in MDAC 2.7 RTM Refresh, they only changed the build number. However, the fact is something that has worked before suddently stopped working after I have upgraded.
If you have experienced a similar problem or have any clue why this is happening please let me know. I need this urgently. I appreciate any help.
Thanks in advance,
Dmitry
Make things as simple as possible, but no simpler. -- Albert Einstein
|
|
|
|
|
hi .. ive seeked the hlp before and i got a response but still after making those changes im not able to save the bitmap file.)
here is the code which im writing .plz tell me where im doing wrong.Or plz snd me the correct code for dat
thanks
void COpenbitmapDlg::OnButtonBmp()
{
// TODO: Add your control notification handler code here
BOOL COpenbitmapDlg::WriteDIB(LPTSTR szFile, HANDLE hDIB)
{
//----------------------------------------
BITMAPFILEHEADER hdr ;
LPBITMAPINFOHEADER lpbi ;
if(!hDIB)
return FALSE ;
CFile file ;
if(!file.Open(szFile,CFile::modeWrite|CFile::modeCreate))
return FALSE ;
lpbi=(LPBITMAPINFOHEADER)hDIB;
int nColors = 1 << lpbi->biBitCount;
hdr.bfType = ((WORD) ('M' << 8) | 'B'); // is always "BM"
hdr.bfSize = GlobalSize (hDIB) + sizeof( hdr );
hdr.bfReserved1 = 0;
hdr.bfReserved2 = 0;
hdr.bfOffBits = (DWORD) (sizeof( hdr ) + lpbi->biSize +
nColors * sizeof(RGBQUAD));
BYTE* pDib =(BYTE*)GlobalLock(hDIB);
file.Write( &hdr, sizeof(hdr) );
// Write the DIB header and the bits
// file.Write( lpbi, GlobalSize(hDib) );
file.Write( lpbi, GlobalUnlock(pDib) );
return TRUE;
}
////////////////////////////////
// calling the above function here
CString m_sBitmap ;
CClientDC dc(this);
static char BASED_CODE szFilter[] = "Bitmap Files (*.bmp)|*.bmp|JPEG Files *.jpeg";
// Create the File Open dialog
CFileDialog m_ldFile(TRUE, ".bmp", m_sBitmap,
OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter);
// Show the File Open dialog and capture the result
if (m_ldFile.DoModal() == IDOK)
{
// Get the filename selected
m_sBitmap = m_ldFile.GetPathName();
// Load the selected bitmap file
//MessageBox(m_sBitmap);
HBITMAP hBitmap = (HBITMAP)::LoadImage(AfxGetInstanceHandle(),
m_sBitmap, IMAGE_BITMAP, 0, 0,
LR_LOADFROMFILE | LR_CREATEDIBSECTION);
// Do we have a valid handle for the loaded image?
if (hBitmap)
{ CBitmap m_bmpBitmap;
m_bmpBitmap.Attach(hBitmap);
BITMAP bmp;
m_bmpBitmap.GetBitmap(&bmp);
CDC dcMem;
dcMem.CreateCompatibleDC(&dc);
dcMem.SelectObject(&m_bmpBitmap);
dc.BitBlt(0,0,bmp.bmWidth,bmp.bmHeight,&dcMem,0,0,SRCCOPY);
WriteDIB("C:\\1.BMP",hBitmap);
}
}
}
looking forward from all the gurus of code
|
|
|
|
|
hDIB is a HBITMAP, not a HANDLE.
go here:
http://www.codeproject.com/bitmap/cximage.asp
and see the difference between CreateFromHBITMAP() and CreateFromHANDLE().
|
|
|
|
|
abey kitni dafa question poochay gaa, bataya tha na key tiberian sun ki cd day kar jaa phir sab sawaloon ka jawab mil jaye gaa.
|
|
|
|
|
Here's a couple of typedefs I'm using
typedef map<cstring, cstring=""> A;
typedef map<cstring, a=""> B;
typedef map<cstring, b=""> C;
I can have anywhere from 4 to 8 C's
Each C can have ~30 B's
And Each B can have anywhere from 2 to 250 A's
The reason a map was choosen is because the speed of searches is the most important and these will only be built once (no adds or deletes).
To build these maps takes about 5 seconds (1.7 Ghz PIV). That's not so bad except a GUI can't be displayed until the maps are built. It looks a little sloppy having that lag.
Anyway, I trying to find a way to speed up the building of these maps. I'm guess that if I can preallocate the maps to a typical usage (4 C's 30 B's and 150 C's), that would improve things.
Any ideas?
|
|
|
|
|
Are you building your maps top-down (first A s, then B s, finally C s) or bottom-up? The latter order is likely to be way faster, since B s and C s store copies of the enclosed types. So, instead of writing
A a;
B b;
b["Hello"]=a; you should write
B b;
A& a=b["Hello"];
Other ways to improve your code:Define B as a map<CString,A*> (and similarly wih C ) to prevent excessive copying. If this imposes a problem with keeping track of the objects (to do the final cleanup), consider some ref-counted smart pointer instead.
Give my block allocator a try (though I wouldn't expect but a modest improvement thru its use.)Good luck.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
In your case (no inserts or deletes), you could achieve similar search performance and faster building with sorted vector s and binary_search algorithm.
|
|
|
|
|
If you use .NET then you may consider using hash_map
Best regards,
Alexandru Savescu
|
|
|
|
|
Hello,
I tested the folowing things:
1. With a CView based MDI project, I added a second document with a CFormView. Butr when I run it and choose the new document I get a debug/assert in viewform.cpp.
Next I tried so that both docs have views based on CFormView. Same problem. View1 shows fine, view2 asserts. ANy ideas?
Thanks,
ns
|
|
|
|
|
Hi! I've just created a button by code, and i would like to have in the same class where it has been created, its control member variable, what i have is :
botao->Create("Cancel", WS_CHILD|WS_VISIBLE, CRect(10, y+120, 60, y+170), this, 1232123);
I use this ast argumento to give it a name and then i edited Resource.h and write : #define IDNB_TESTE 1232123, 'assigning' that id number to a name, which i would use in DDX:
DDX_Control(pDX, IDNB_TESTE, m_teste);
then i tried to use the m_teste variable, but i kept receiving errors, what ave i done wrong? How can i do this?
Thank you for your time
|
|
|
|
|
I found it, i had just to had BS_PUSHBUTTON and process the ON_BT_CLICKED message with the id i had chose to the function.
Thank you the same
|
|
|
|
|
Hi,
I use Visual C++ 6.0 and have problem working with MS Access Database 2000:
a) After I created a database table with MS Access 1997, then later if I use Class Wizard (in Visual C++ 6.0) to add a new class with DAO option (CdaoRecordSet or CDaoRecordView) ... there is no problem, every thing working fine!
b) But if I created a database table with MS Access 2000, then when I add a new class with DAO option (CdaoRecordSet or CDaoRecordView) ... it did not allow and said "unrecognized format"
- I did add this code: AfxGetModuleState()->m_dwVersion = 0x0601; to let Visual C++ recognize new driver, I also download "DaoPatch.dll" and put it into \Program Files\MS Visual Studio\VC98\Setup\1033 & \Program Files\MS Visual Studio\Common\Wizzard98 ... still had the same problem!
- Even I tried to update with Microsoft Visual Studio 6.0 Service Pack 5 that claimed improvement some problem with DAO 3.6 files (Dao header & cpp files... the result is the same!
*) I know it should work, but I do not know how to do it? Can any one help me?
I am really appreciate it! Thanks.
Thanh Chau
|
|
|
|
|
You need the latest version of MDAC. You can probably get it off the MS web site.
------- signature starts
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
Please review the Legal Disclaimer in my bio.
------- signature ends
|
|
|
|
|
I found this function:
LRESULT CMainFrame::OnTestMessageLParam(WPARAM wParam, LPARAM lParam)
used by some sample code. But when I went to "add windows messsage handler" in the mainframe class context menu I didnt see any thing like wm_message or something. SO where is this function coming from and what does it respond to? Shouldnt it have been in the context menu?
|
|
|
|
|
If you are using MFC you most surely have the source code also. Search the MFC src directory for OnTestMessageLParam .
|
|
|
|
|
Hi There,
Does anybody know the best way of rendering a 2d circle outline onto 3d device of a known number of pixels readius? I've tried rendering it by making vertex buffer with some points arranged in a circle drawn in close proximity to the camera, but it seems to be a bit of a convoluted way of going about it... Does anybody know a better way of overlaying 2d shapes into the buffer?
Thanks for you help...
With time we live, with money we spend!
Joel Holdsworth
|
|
|
|
|
Draw a plain circle on a bitmap and the use it as a texture.
Since this is also how it's done in OpenGL you might have a look at e.g. "NeHe Productions" or opengl.org (note, you might get biased against proprietary API's using free information like this :->).
|
|
|
|
|
My app will have only two MDI docs and two views (one for each). No new views or windows can be created. I want to show (or spawn) doc2 and view2 in response to a buttonclick on view1. Then after the user has finished entering data in view2, I want to click a button, get rid of view2 (destroy or hide), and show view1 (updated) again. How do I go about doing this?
I am working on how to get view1 the info returned by view2 in a separate thread.Thanks so much,
ns
|
|
|
|