|
Hi all
I create a file by using CStdioFile.
I want to sent this file to Printer, which function should i use?
Thanks
|
|
|
|
|
- Use
ShellExecute()
ShellExecute(m_hWnd, "print", "MyFile.txt", NULL, NULL, SW_HIDE);
This will execute the program associated with the .txt extension and tell it to print the file.
- Use
system()
system("copy "MyFile.txt" lpt1:");
This will send the file to the printer using the DOS copy command. Note that the last (partial) page will probably not be printed, unless you send a formfeed.
- Use MFC's doc/view printing architecture. See the Printing section here on CP for more details.
HPS HwndSpy - GUI developer's aid to visually
locate and inspect windows. For the month of August
only, use coupon code CP-81239 for 30% off.
|
|
|
|
|
hello world,
I develop video capture application, and i need to extract frames as bmp.
I use directshow to capture my 1394 dv, and vfw.h to extract frames.
capture is ok and works quitte well.
But (terrific 'but'!!)
when i try to use vfw.h functions, compilation gives no error, but i always have the sam linking errors
error LNK2001: unresolved external symbol _AVIFileInit@0
I tried everything, vfw32.lib seems to be the same version, it describes the same functions...
My project is not a commercial one, it has artistic purposes. Deadlines are getting closer and i am afraid to be late.
PLEASE HELP
Mr PIER
|
|
|
|
|
Go to Project | Settings | Link | Object/library modules, and add Vfw32.lib.
HPS HwndSpy - GUI developer's aid to visually
locate and inspect windows. For the month of August
only, use coupon code CP-81239 for 30% off.
|
|
|
|
|
thanks
it helped,
but i can't launch AVIStreamOpenFromFile even if i close the directshow's capture graph, i don't understand why
any idea ??
|
|
|
|
|
Hi All,
I Want to use the newwindow event to not open the new window and open the
same link in parent window...I have declared the function like this..
DISP_FUNCTION_ID(CWebBrowser2, "NewWindow2",DISPID_NEWWINDOW2, OnNewWindow,
VT_EMPTY, VTS_BSTR VTS_I4 VTS_BSTR VTS_PVARIANT VTS_BSTR VTS_PBOOL)
and the function definition says..
void CBrowser::OnNewWindow(BSTR URL, long Flags, BSTR TargetFrameName,
VARIANT* PostData, BSTR Headers, BOOL FAR* Cancel)
{
if (m_pBrowserApp) {
COleVariant varEmpty;
if (Cancel != NULL )
*Cancel = TRUE;
m_pBrowserApp->Navigate(URL, &varEmpty, &varEmpty, &varEmpty, &varEmpty);
}
}
MSDN says it should work like this only..but unfortunately this is not
working for me..Pls helpAny help or pointers are higly appreciated..Thanks a
lot in advance..
Himanshu
|
|
|
|
|
Hi,
I've build an application with some documentation (in an Adobe PDF format), and I must build a button in my app to show this documentation.
Do you know wether I can open this file from my own program (please add some sample code, using "help.pdf", or something like it), if this isn't possible, can I do it with ms word (doc format help).
Thank you in advance,
Boudewijn
|
|
|
|
|
Use ShellExecute() :
ShellExecute(m_hWnd, "open", "help.pdf", NULL, NULL, SW_SHOW);
This assumes that Acrobat is installed.
HPS HwndSpy - GUI developer's aid to visually
locate and inspect windows. For the month of August
only, use coupon code CP-81239 for 30% off.
|
|
|
|
|
Hi,
I need to have some kind of control to select a directory, just like a file:
There must be some kind of dialog, like an openFileDialog, wich can select directories, instead of jsut files.
Does anyone know wether there is such a control, and where can I find it in MFC?
Thank you in advance,
Boudewijn
|
|
|
|
|
SHBrowseForFolder
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Hi,
thanks for helping, but I don't understand how to get a BROWSEINFO structure, can you give a hint (or the solution)?
Thank you,
|
|
|
|
|
The MSDN documentation has plenty of examples:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shbrowseforfolder.asp
|
|
|
|
|
http://www.codeproject.com/useritems/browse_for_folder_part_2.asp?target=folder%7Cbrows
Yes,Free Code project~~~~
|
|
|
|
|
I need special log/history window control where the first line that is entered appears at the bottom, and the contents are scrolled upwards. (Like in mIRC). And it must be able to select the text. Maybe there is a way to modify CEdit class?
|
|
|
|
|
void EnsureVisible()
{
// The pointer to my edit.
extern CEdit* pmyEdit;
int nLines = pmyEdit->GetLineCount();
// Scroll the edit control so that the first visible line
// is the last line of text.
if (nLines > 0)
{
pmyEdit->LineScroll(nLines+1, 0);
}
}
Then,you can call this function so that the last line is always visible.
Yes,Free Code project~~~~
|
|
|
|
|
Thanks for scrolling, but i need the first line to be displayed at the bottom of CEdit. Imagine empty Edit control. Then i call some AddLine(...) function and this line appears at the bottom (not at the top like CEDit does). The second line moves first one upward and so on.
Generally i need something like this
http://www.codeguru.com/controls/output_window.shtml
but with ability to select text
|
|
|
|
|
Derive CMyEdit from CEdit. Add this method to CMyEdit:
void CMyEdit::Insert(LPCTSTR lpszText)
{
SetSel(0, 0);
ReplaceSel(lpszText);
}
Add lines to edit box like this:
CMyEdit m_edit;
.
.
.
for (int n = 0; n < 100; n++)
{
CString str;
str.Format("This is line %d\r\n", n);
m_edit.Insert(str);
}
Note: in Resource Editor, make sure edit box has styles multiline, vertical scroll, and auto vscroll.
HPS HwndSpy - GUI developer's aid to visually
locate and inspect windows. For the month of August
only, use coupon code CP-81239 for 30% off.
|
|
|
|
|
HPSI have done it.
May be, you need the first line is always visible.
void EnsureVisible()
{
// The pointer to my edit.
CMyEdit m_edit;
int nFirstVisible = m_edit.GetFirstVisibleLine();
// Scroll the edit control so that the first visible line
// is the last line of text.
if (nFirstVisible > 0)
{
m_edit.LineScroll(-nFirstVisible, 0);
}
}
Yes,Free Code project~~~~
|
|
|
|
|
hello,
I want to send a pointer from my VB client app. to a VC dll the code is :
for VB
-------
Private Declare Sub GenerateReport Lib "Generator.dll" (ByVal datele As ADODB.Recordset)
Private Sub Command1_Click()
Dim con As ADODB.Connection
Dim rs As ADODB.Recordset
c = "PROVIDER=sqloledb;server=romulus;uid=sa;pwd=951;DataBase=SindServLast"
Set con = New ADODB.Connection
con.Open c
Dim s As String
s = "select * from T_USR_Useri"
Set rs = con.Execute(s)
GenerateReport rs
End Sub
fot VC dll
-----------
void GenerateReport(_RecordsetPtr pRs)
{
pRs->MoveFirst();
CString text;
text=(char*)((_bstr_t)pRs->Fields->GetItem((_variant_t)("usr_LoginName"))->Value);
}
and everything works fine in vc ... the pointer is recived correctly and the text CString is filled ok but after that when my c++ function ends and the execution returns to VB the VB client crushes ... and raise an access violation error ..
why ?
thanks !!!!!
|
|
|
|
|
Perhaps you should be use "_RecordsetPtr* pRs".
Try it,then you could be success.
Yes,Free Code project~~~~
|
|
|
|
|
suncho wrote:
Perhaps you should be use "_RecordsetPtr* pRs".
I doubt it. _RecordsetPtr is a smart pointer. Nevertheless, he could try it. You have no idea how many times I am wrong.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
this is a way, yes, use a pointer's pointer.
In fact, i doubt it too, but should be try.
Yes,Free Code project~~~~
|
|
|
|
|
if I use _RecordsetPtr *pRs it will get me compiler errors ... _RecordsetPtr it is already a pointer ... and his sizeof is 4
|
|
|
|
|
Hi,
I would like to convert a hexadecimal value to decimal. is there any method in C++ available for me to do that??
For example :
The hexadecimal value of '5a' should be converted to 90 in decimal.
Thanks.
|
|
|
|
|
long lVal = 0x5a;
Yes,Free Code project~~~~
|
|
|
|