|
Hi
I have a drag drop handler. When i drag drop a file to a network path. I am getting the path like this "C:\Documents and Settings\720452\NetHood\Temp - infch01152\新規Microsoft Word Document.doc". But the share name is \\infch01152\temp. Is there any way by which i can get the original path from the path mentioned above. Thanks in advance.
|
|
|
|
|
hi,
I want to create a mdi application without menu which has 3 child window with 3 different behaviors one contain some controls other one does not contain these it has different behavior. can DOC/View arch. is usefull.
Any idea about these types of req. or i need to create my own MDI archi.
Dinesh Kulkarni.
|
|
|
|
|
Oh sorry ,
I mean I used IsNetWorkAlive and IsDestinationReachable.
these two functions always returning true.
I didnt understand the ISensNetwork how we can use that
|
|
|
|
|
Aby Skaria wrote: I didnt understand the ISensNetwork how we can use that
See here.
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
hi...
let get straight to the question... if i want to implement MS SAPI interface, so i can have my custom TTS have the same interface with MS SAPI, what should i do?
thx...
|
|
|
|
|
Greetings,
I would like to retrieve the whole document text from an active text window in Visual Studio 98.
For now I select all text and retrieve it via TextSelection (language: C++). Here the pseudo code:
...<br />
TextDocument doc = getActiveDocument();<br />
rememberCurrentSelection(sel);<br />
TextSelection sel = doc.getCurrentSelection(); <br />
<br />
sel.selectAll();<br />
wstring wholeText = sel.getText();<br />
<br />
restorePreviousSelection(sel);<br />
...
Drawbacks:
o Selection of all Text causes flicker effects
o Restauration of previous text selection often will change scroll position
Is there any way to retrieve the text without these drawbacks?
Thank in advance,
Jacek
>> User error. Replace user and strike a key <<
|
|
|
|
|
hicks22 wrote: an active text window
If you have a handle on the window, you should be able to get the text easily, no ?
~RaGE();
|
|
|
|
|
GetWindowText() will return NULL for the desired window, already tried.
|
|
|
|
|
Hi,
I have been thinking about the problem below for a week , Is there anyone can help me?
I m working on a MFC program, and I want to make the program support console (Command Line). I don't know why I can't use cout or printf to print anything out. I thought It could display messages on console when I launch the program on console (windows xp), like:
c:\app.exe -number 1
but nothing came out on consle actually. I know that I can create another console to recieve messages from cout and printf, but I don't want to create any console in my program, I just want print some message on original console. In Java, we can print message on console by using System.out.print(), so is there any way, function or class I can use to print messages on the console in MFC program? Could you show me a simple example?
Thanks so much!
David Zuo
|
|
|
|
|
Everything is a bit mixed up in your post.
- A console program does usually not involve any mfc. It is a program that usually does not have any GUI and in which you can use cout and cin.
- An MFC application is an application using classes that makes it easy to handle the GUI.
Both are seldom mixed together.
- A command line is a set of parameter you can give to your executable, no matter if it is a console application or a MFC app, it works in both ways.
c:\app.exe -number 1
David.YueZuo wrote: nothing came out on consle actually
What did you expect here ? How are you handling the command line in your application ?
David.YueZuo wrote: I can use to print messages on the console in MFC program
As I explained, MFC and console are usually different types of app. If you want to display something in a MFC app, use a CEdit , a CStatic or a MessageBox .
~RaGE();
|
|
|
|
|
Thanks so much for your infor.
Here,
c:\app.exe -number 1
app.exe is just a MFC program (GUI-Based), I added some printf statements in it, like printf("Hello, world"), I hope this "Hello, world" can be displayed on my console. Actually, I used CEdit, CStatic and MessageBox as well, but only if I want the messages to be displayed on a dialog, editor.
In Java, we can have:
{
......
JOptionPane.showMessageDialog("Hello World");
System.out.print("Hello World");
......
}
then, message "Hello world" will be displayed on two different places, one is on a dialog, another is on the console. I want to use the same way to deal with messages in MFC. Could you tell me how to do?
Thanks
David Zuo
|
|
|
|
|
A GUI program is usually not connected to a console. On your windows dektop, you may have 0 to many consoles, so which one would you like to send your messages to? Like you said yourself, you can allocate a console to your application using "AllocConsole ()" When you do that, then your printf statements will send their output to this console.
William
|
|
|
|
|
Now, I open a console by using "run" -> "cmd", type the directory of the file, then run my program on this console like:
c:\cd temp
c:\temp\app.exe -number 10
Again, app is a GUI-based MFC program, I added some printf statements in it, like printf("Hello world"); or std::cout << "hello world"; I hope the message "Hello world" could be displayed on my current console. Could you tell me how to do?
Thanks!
David Zuo
|
|
|
|
|
As said before, your app and the console are two separate programs. If you start your MFC application from a console, then this application will start independently of that console. I.e., the two will not be connected! The only way is to allocate a console window to your application with AllocConsole. For as far as I know, it is not possible to connect an existing console to you MFC application.
William
|
|
|
|
|
David.YueZuo wrote: I want to use the same way to deal with messages in MFC
This is difficult. As I already explained, MFC and console are two different kinds of application. I may even add that mixing both of them is extremely bad design, IMO .
What are you trying to achieve exactely ? Why do you need a console aside your application ? Do you really think the user of your app wants to have a console pop up, or is this only for debugging purposes ?
This may be a start point:
QuickWin[^]
However, this is the opposite to what you need: make a console run as a plain Win32 application.
~RaGE();
|
|
|
|
|
Actually, I was a Java programmer. In Java, we can use both ways to display messages, no matter on console or GUI. Now, I am a C++ programmer, I m trying to use the same way to create a GUI-based MFC program.
To create a console aside GUI for a actual user may not a good idea, but for the designer and programmer, it's a esaier and faster way to debug and monitor our program. In fact, I don't want to create any console, instead, I want to make the program able to run on console, and to recieve arguments from console. Also, program's messages would be displayed on current console during the running time.
David Zuo
|
|
|
|
|
You can use debug statements in your MFC application, using 'OutputDebugString()' (if i remember correctly). The strings supplied as an argument will be displayed in the 'Output' section of Visual Studio (assuming that you use VS ofcourse ). You can also use an external debugging application that is able to capture output generated by 'OutputDebugString()'. You can use 'windbg' for example to receive the debugging output.
Er zit een korstje op mijn aars.
|
|
|
|
|
you may use a RichEdit Control to display debug info etc.
http://www.codeproject.com/richedit/RichEditLog_Demo.asp
In order to enable a kind of interaction through commands (and do not want to use button etc.) , you can embed (TCL, LUA, Python) in or develop a small scripting facility.
Bekir.
|
|
|
|
|
Hi,
can any one help me!
I am working with USB Printers,
i have VID,PID,HARDWARE ID,COMPATIABLE IDs and Its descriptors also,
now i want to get Printer name using the above available INFO!
(to learn about any printer using SDK APIs it need Printer name)
Address me at :
aare_ravinder@yahoo.com
or
ravinder.are@gmail.com
Thanks,
Are
|
|
|
|
|
DWORD dwSize; // Size of the Buffer
DWORD dwPrinters; // No of printers
/* Get the size of Bufer*/
::EnumPrinters(PRINTER_ENUM_LOCAL, NULL, 5, NULL, 0,
&dwSize, &dwPrinters);
BYTE* pBuffer = new BYTE[dwSize];
/* Fill the Buffer */
::EnumPrinters(PRINTER_ENUM_LOCAL, NULL, 5, pBuffer, dwSize,
&dwSize, &dwPrinters);
/*Get the No of printer*/
if(dwPrinters != 0){
PRINTER_INFO_5* pPrnInfo = (PRINTER_INFO_5*) pBuffer;
if(pPrnInfo == NULL){
return(FALSE);
}
for(UINT nCnt=0; nCnt<dwPrinters;nCnt++){
// pPrnInfo->pPrinterName
// is the name of the printer
pPrnInfo++;
}
}
delete[] pBuffer;
|
|
|
|
|
no Anil,
see my Q once again!
what my Q is ,by using the VID,PID,HWID or Descriptors may i get printer name?
By enumerating i don't get any of the above info what i have,
if in any way i get any of VID,PID,HWID with enumeration i will compare
that data, and i will collect printer name
but the _PRINTER_INFO_5 is as below
typedef struct _PRINTER_INFO_5 {
LPTSTR pPrinterName;
LPTSTR pPortName;
DWORD Attributes;
DWORD DeviceNotSelectedTimeout;
DWORD TransmissionRetryTimeout;
} PRINTER_INFO_5, *PPRINTER_INFO_5;
will u pls think of this and replay me!!!
cheers
Are
|
|
|
|
|
Hi
First make me clear some points.
The previous code can get printer name if it is installed in your PC. now problem is about USB printer. right?
Ravinder Are wrote: if in any way i get any of VID,PID,HWID with enumeration i will compare
that data, and i will collect printer name
Do you have any of the VID/PID OR HWID or you want how to get them? With what you are going to compare?
Please make your Q little more clear.
|
|
|
|
|
Anil,
1.i have one USB Printer i dont know its name
2.That printer connected to one of my USB ports.
3.i know that printer's VID/PID and HWID.
4.now by using any/all of ID/PID and HWID i would like to get printer name.
if there is any way to get USB Printers VID/PID,HWID and Printer Name collectively(like structure),i wll compare my vid/pid or HWID with the data that i get in some way and i will collect the printer name in the same data(like structure).
i want that way( how to get Printers VID,PID,HWID by using any of SDK fun..?)Cheers,
Are
|
|
|
|
|
If you can use DDK then
try this API UsbBuildGetDescriptorRequest()
and also the structure USB_DEVICE_DESCRIPTOR
or your can get the VID and PID from registry or INF file describing such a device.
Regards
Anil
|
|
|
|
|
Ravinder Are wrote: now i want to get Printer name using the above available INFO!
is EnumPrinters is of any help
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|