|
Hi,
I'm new to MFC, my question is how to get a pointer to CDocument in a non CView class?
For example in a docking window or a CDialog.
|
|
|
|
|
Jim Jim wrote: I'm new to MFC, my question is how to get a pointer to CDocument in a non CView class?
Simpler solution to declare the global Pointer to document class and access that in your Non View Class
|
|
|
|
|
The best approach is to use something like the following:
CMyFrameWnd *frame = (CMyFrameWnd *)AfxGetMainWnd();
CMyDocument *document = frame->GetActiveDocument();
Software Zen: delete this;
|
|
|
|
|
Hai to all,
I would like to know how an AfxBeginThread function works for staring a thread.i have gont through the msdn help.But being a starter i couldnt get that syntax properly.so help me to know about that function in a clear way about what it doing and what parameters are used in that function.
|
|
|
|
|
|
Hi,
I want to develop a Network Monitor and filter(for Windows Platform) as my final project in Visual C++
( either in MFC or Win32)
so does anyone know from where should i initiate??
That is what APIs need to learn ?
what SDKs i need to download ? e.t.c
so please help me bcause i am running out of time ,please kindly acknowledge my message...
Thank You
The Only Way To Get Smarter is By Playing Smarter Opponent
|
|
|
|
|
ntimesc wrote: what SDKs i need to download ? e.t.c so please help me bcause i am running out of time ,please kindly acknowledge my message...
try this libaray WinpCap[^], it provide ready made solution to your problem
|
|
|
|
|
thanks 4 replying me
but this project i also want to submit in Microsoft Acedmics Projects , so i aksed them for WinCAP but they said you can't use that (third party) library..... so do u have another solution
The Only Way To Get Smarter is By Playing Smarter Opponent
|
|
|
|
|
ntimesc wrote: but this project i also want to submit in Microsoft Acedmics Projects , so i aksed them for WinCAP but they said you can't use that (third party) library..... so do u have another solution
then try Iphelper apis provided by MS itself :-
IPHELPER[^]
or have a look at firewall example listed here
Firewalls[^]
|
|
|
|
|
Hi,
I am using a filter in GraphEdit. It's woring fine.
But I want to set it's properties through coding.
I have 3 file of that filter. So I used them, then it is giving error as follows,
--------------------Configuration: a - Win32 Debug--------------------
Compiling...
aDlg.cpp
Linking...
aDlg.obj : error LNK2001: unresolved external symbol _IID_IDtInputFlt
Debug/a.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Creating browse info file...
a.exe - 2 error(s), 0 warning(s)
--------------------------------------------------------------------
So plz tell me how to set DirectShow Filter Properties through Code?
Thanks in Advance.
|
|
|
|
|
Hi guys,
I am trying to write into xls file. This part is ok.
problem occur while reading from xls file.
error shows as follows :
syntax error in query expression field_2 by demo
code I use for writing into xls file is as follows.
void CWrite_read_xlsDlg::OnButton1()
{
CDatabase database;
CString sDriver = "MICROSOFT EXCEL DRIVER (*.XLS)";
CString sExcelFile = "c:\\kdr.xls";
CString sSql;
TRY
{
sSql.Format("DRIVER={%s};DSN='';FIRSTROWHASNAMES=1;READONLY=FALSE;CREATE_DB=\"%s\";DBQ=%s",
sDriver, sExcelFile, sExcelFile);
// create database i.e excel sheet
if( database.OpenEx(sSql,CDatabase::noOdbcDialog) )
{
// create table structure
sSql = "CREATE TABLE demo (Name TEXT,Address TEXT)";
database.ExecuteSQL(sSql);
// insert data into table i.e excel sheet
sSql = "INSERT INTO demo (Name,Address) VALUES ('Nilesh','Pune')";
database.ExecuteSQL(sSql);
sSql = "INSERT INTO demo (Name,Address) VALUES ('akash','Mumbai')";
database.ExecuteSQL(sSql);
sSql = "INSERT INTO demo (Name,Address) VALUES ('ajit','thane')";
database.ExecuteSQL(sSql);
sSql = "INSERT INTO demo (Name,Address) VALUES ('aaniket','Nashik')";
database.ExecuteSQL(sSql);
}
// close database
database.Close();
}
CATCH_ALL(e)
{
TRACE1("Driver not installed: %s",sDriver);
}
END_CATCH_ALL;
}
code I use for reading data from xls file
void CWrite_read_xlsDlg::OnButton2()
{
CDatabase database;
CString sSql;
CString Name, Address;
CString sDriver;
CString sDsn; // register datasource in ODBC database manager
CString sExcelFile = "c:\\kdr.xls";
m_cList.ResetContent();
sDriver = GetExcelDriver();
if(sDriver.IsEmpty())
{
AfxMessageBox(" No Excel ODBC driver found ");
}
sDsn.Format("ODBC;DRIVER={%s};DSN='';DBQ=%s",sDriver,sExcelFile);
TRY
{
database.Open(NULL,false,false,sDsn);
//A CRecordset object represents a set of records selected from a data source.
//Known as recordsets
CRecordset recset(&database);
sSql = "SELECT field_1,field_2"
"FROM demo "
"ORDER BY field_1";
// sSql = "SELECT * FROM demo";
// sSql = "INSERT INTO demo (Name,Address) VALUES ('Nilesh','Pune')";
//"ORDER BY Name";
recset.Open(CRecordset::forwardOnly,sSql,CRecordset::readOnly);
while(!recset.IsEOF() )
{
recset.GetFieldValue("field_1",Name);
recset.GetFieldValue("field_2",Address);
m_cList.AddString(Name + " --> "+Address );
// m_cList.AddString(Name);
recset.MoveNext();
}
database.Close();
}
CATCH(CDBException, e)
{
AfxMessageBox(" Database error : "+e->m_strError);
}
END_CATCH;
}
call GetExcelDriver().implementation of GetExcelDriver()is written separately.
Read data and dispay is occur when I click on button.
kindly give me a reply where I am wrong.
Refards
kedar
Girish
Software Developer
|
|
|
|
|
hi all i need to set the icon and run application of my new file format like *.eee
i am using VC++. i need some registry add application and i also need the problem solution
thanks
regards
sasikumar
|
|
|
|
|
Hi sasikumarselvarajan ,
Do you want to create eee instead exe?
|
|
|
|
|
First you don't need an extra application to register a file type.
Second you have already replied to a topic where the answer was given right here[^].
Third do some research before asking for answers.
|
|
|
|
|
hello,
can anybody please tell me, how can I make a installer/ setup ( self installing cd) with the executable compiled in VC++ ?The operating system is WINDOWS-2000.
I want to make a package with the final executable.
Please reply
thanks
|
|
|
|
|
You can use a setup creating program. I use Inno Setup[^].
Regards,
Rajesh R. Subramanian
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
|
|
|
|
|
Inno Setup is great, and so easy to use, I would also recomend this
|
|
|
|
|
rajeevktripathi wrote: I want to make a package with the final executable.
yeap INNOSETUP is one finest free installer available in market if you are developing a simpler installer, otherwise you have to learn pascal type scripting to make complex installation program using same! just a warning
|
|
|
|
|
Hi,
I've used recordsets,I need to retrieve many records say two,so I tried to use while(!mp=ISEOF())
{
m_name1=mp->m_name
UpdateData(false)
}
Its getting strucked.If I use if(!mp=IsEof()),it gets me only one record
swapna_signsin
|
|
|
|
|
if(!mp==IsEof())
or
while(!mp==IsEof())
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
hi
sorry,I didn't use the code I specified but its,if(!mp->IsEof()),Ialso tried the code given,but that doesn't work.
need hlp
swapna_signsin
|
|
|
|
|
Sir when open my resource editor or when i click.
on any resource dialog i am getting a messagebox
informing .clw file is changed out the editor.
this messagebox is just coming continously.not allowing me
to do any thing pls help me what should i do in order to
avoid it.so that my application runs smoothly.
thank you
Fly Like An Eagle With MIGHTY POWER.
|
|
|
|
|
satishvarma_e wrote: Sir when open my resource editor or when i click.on any resource dialog i am getting a messagebox informing .clw file is changed out the editor.this messagebox is just coming continously.not allowing meto do any thing pls help me what should i do in order to avoid it.so that my application runs smoothl
delete you project_name.ncw,project_name.clw and project_nameaps file and restart your visual studio again. may be one of these files get corrupted!
|
|
|
|
|
I have a program that gets a set of 3 messages every second or so.
The message:
- hwnd is NULL (thread message, not window message)
- message is 49338 (0xc0ba)
- LPARAM, WPARAM change for each of the 3 messages
Messages between 0xc000 and 0xffff are string messages generated by RegisterWindowMessage().
I don't call RegisterWindowMessage, which leads me to believe either the debugger or another library (e.g. OpenGL) has created the message.
How can i find who called RegisterWindowMessage to get the message id 0xc0ba ?
And/or, how can i find what string was passed to RegisterWindowMessage ?
...cmk
Save the whales - collect the whole set
|
|
|
|
|
I don't think you can reverse the RegisterWindowMessage() function, but if you have Spy++ installed (it's part of the Visual Studio installation, Tools->Spy++) you can use it to find out which application is sending the messages. Run Spy++, use the Find Window dialog to pick your root window, choose the 'show messages' option and then hit OK. A window will pop up showing all the messages your application is receiving, and you can then find the offending messages.
You usually see lines in the Spy++ application that look like:
000D072C S message:0x1065 (User-defined:WM_USER+3173) wParam:00000000 lParam:00000000
000D072C R message:0x1065 (User-defined:WM_USER+3173) lResult:00000000
If you double-click on the 'S' line you'll see information about the sender of the message. Going to the 'Process' tab will then allow you to find out who's sending the message.
In my experience the usual culprits for sending out lots of messages like this are media players which broadcast information about where they are in the song so that third-party plugins can show song information etc.
I know this isn't quite an answer to your original question, but I hope it's useful!
Matt Godbolt
Engineer, ProFactor Software
StyleManager project
|
|
|
|