|
TCHAR c = str.GetAt(0 );
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thanks David - that's EXACTLY what I was looking for. When I searched for it in MSDN it kept giving me a reference to a CHString (whatever that is..)
|
|
|
|
|
It's similar to CString but without MFC's overhead. The WMI classes seem to make extensive use of it.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Or, to get a:
str[0];
for b:
str[1];
and so on
Who are all these people and what are they doing in my house?...Me in 30 years, inside a grocery store
bdiamond
|
|
|
|
|
Dear All
I have an ActiveX control in Visual Basic (an enhanced flexgrid ocx). I am using this control in an VC++ application (dialog box app).
The control has a context menu, having options like cut, copy, paste etc. This menu is invoked when i right click on the control.
I want to use the cut and paste options using the context menu, to cut and paste data available in the control into the cells of the control.
The problem that I am facing is that, when click on the menu items, the event is raised in Visual Basic, but I want to make that event available in VC++ to move data to and from the Clipboard.
Any help available would be greatly appritiated.
Thanks in Advance...
Manoj
|
|
|
|
|
I have two processes (both written by me, i.e. I can modify them at will). When bot are already running, one (the server) needs to create a COM object, and pass an interface to the other (Client).
My only problem: how do I get one interface (IUnknown) marshaled to the other process?
(*using* a COM object in another process I already tried a few times, but they were always instantiated using CreateInstance)
I *think* I have to register the object in the Running Object Table (ROT), and notify the client that it's now there. However, I never really understood this Moniker business (beyond being, well, a Moniker), and I can't find a default implementation that seems usable out of the box.
is the ROT the right way? What Moniker?
additional info: The client will control the server, but I have some external requirements not solvable through COM, which force me to create the process manually. Also, there should be multiple Client/Server pairs (or even One client with multiple servers) possible, I guess differen monikers could solve that...
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist Fold With Us! || Agile Programming | doxygen
|
|
|
|
|
I do it like this ...
ServerFunc(LPDISPATCH *p)<br />
{<br />
CMyClass object;
LPDISPATCH lpDisp = object.GetIdispatch(TRUE);
*p = lpDisp;<br />
}<br />
<br />
<br />
#include "server.h"
void foo()<br />
{<br />
LPDISPATCH *lpDisp<br />
ServerFunc( &lpDisp );<br />
IMyClass *pMyClass = new IMyClass(lpDisp);<br />
}
It works for me
|
|
|
|
|
The problem for me is: ServerFunc runs in a different Process, so I just can't pass the IDispatch * this way.
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist Fold With Us! || Agile Programming | doxygen
|
|
|
|
|
I am trying to access the StudentTable in an Oracle database, I have set the data source correctly. There is also no errors reported
after I built the exe file. but when I ran the exe, I can see the messagebox showing the "connectinon to the database succeeds." In the following step, there is
a messagebox with title "Microsoft Visual C++ Runtime Library" showing "Runtime error ...".
I don't know where is wrong , here is the code, who could tell me where is wrong? Thanks.
BOOL flag=FALSE;
flag=m_db.Open("MyDSN",FALSE,FALSE,"ODBC;UID=user1;PWD=userpwd",TRUE); //m_db is a CDatabase member object.
if(flag)
AfxMessageBox("connectinon to the database succeeds.");
else
AfxMessageBox("connectinon to the database failed.");
CRecordset rs(&m_db);
try
{
if(rs.IsOpen())
rs.Close();
if(rs.Open(AFX_DB_USE_DEFAULT_TYPE,_T("select * from user1.StudentTable"),CRecordset::readOnly))
AfxMessageBox("Recordset has been opened!");
}
catch(CDBException e)
{
e.ReportError();
AfxMessageBox("Failed to open the recordset");
}
|
|
|
|
|
Have you single-stepped through the code to see which statement is causing the error?
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
|
I am writing software that parses out an RTF file. One of the things I want to do is extract pictures and save them to a file. The following is taken directly from Microsoft's RTF FAQ (version 1.3):
---- From RTF FAQ ---
The picture in hexadecimal or binary format follows the picture-destination control words. The following example illustrates the destination format:
{\pict\wbitmap0\picw170\pich77\wbmbitspixel1\wbmplanes1\wbmwidthbytes22
\picwgoal505
\pichgoal221
\picscalex172
\picscaley172
49f2000000000273023d1101a030
3901000a000000000273023d98
0048000200000275
02040000200010275023e000000000
273023d000002b90002b90002
b90002b90002b9
0002b90002b90002b90002b90002b90002
b92222b90002b90002b90
002b90002b9
0002b90002b90002b90002b9000
---- End of Stuff from RTF FAQ ---
I am able to parse out all of the bytes (in this example, beginning 49f2...) and I convert them from their text representation to real bytes (i.e., the character sequence "49" is converted to 0x49), but what I get is not a readable picture.
Here is more detail: Suppose I have a bitmap file. I take the same picture and embed it in an RTF document. I can open up the document in Notepad and view the hexidecimal represeantion of the image. I have also written a program that can read a binary file such as a bitmap and convert it to the text equivalent of a hexidecimal as it would appear embedded in the RTF document. I then visually compare the hex I generated directly from the hex embeded in the RTF file.
The hex from the RTF file is the same as the hex I generate directly from the disk file... EXCEPT for the first several hundred bytes! Each source starts out different, but after a hundred byts or so, each is then the same, so I know my encode/decode should be working.
But why is the hexidecimal of the embedded picture not exactly the same as the hexidecmal of the disk file? According to the RTF FAQ, they should be. What can I do to extract the picture? Did Microsoft do something to encode the first series of bytes for a picture so that no one else can extract it?
I have found this problem with both bitmaps and GIF files. I am using MS Word 95 to generate the RTF files with pictures embedded.
|
|
|
|
|
I don't know the answer, but from your question, it sounds like some picture header is being modified. I'd look for specs for your picture format, and manually compare the hex. It wouldn't surprize me if Word was changing something in the headers, but you can't know unless you start reading.
Have your tried other programs that read rtf? There are some free ones. (Open Office comes to mind). Perhaps there is a bug in word95, or it isn't implimenting the same version of rtf as what you are working on.
If you are encoding, can word read your document? How about other programs. If you just want to decode, save some pictures in rtf, decode, and see if they look the same.
Don't forget to extract your pictures with Word again (if you can) to see if it saves the same thing as the origional.
The way you worded your question I suspect your program is working correctly. If your pictures look the same visually, I wouldn't worry about it. If there are visual differences, you are on the right track to solving them.
|
|
|
|
|
I believe that it's a OLE Stream that embeds the picture, not a straight picture.
--
Joel Lucsy
|
|
|
|
|
Hi everybody.
I'm looking for a nice algo which I can use for parsing audio-files and extracting tags. The algo should have the possibility to define the structure of the filenames via a mask and wildcards. Several programmes make use of such a method, for example Tag&Rename: http://iserver.hta.fhz.ch/~iasummer/stuff/tagrename.gif
I haven't found a good and free avaiable source code for parsing files like that, so any links or general information would be great!
|
|
|
|
|
Are you wanting a masked edit control, or are you wanting to find files based on special characters (in addition to "*" and "?" which are already supported).
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
me think he want to do the following :
for a filename like
"01-Pink Floyd-The Dark Side Of The Moog-Money.mp3"
he wants to extract the song number, artist, album and track name.
basically, a sscan.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Maximilien wrote:
basically, a sscan.
I assume you mean sscanf() . If so, then something like the following would work:
char *lp = "01-Pink Floyd-The Dark Side Of The Moog-Money.mp3",
szNumber[8], szArtist[16], szAlbum[32], szTrack[16];
sscanf(lp, "%[0-9]%*c%[^-]%*c%[^-]%*c%[^.]", szNumber, szArtist, szAlbum, szTrack);
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
|
Yeah, sscanf looks like the thing I need. I have to write a programme where the user can specify the structure of a file to get the tags from the filename.
E.g. if you have an MP3 Files with the structure like this:
"01-Pink Floyd-Dark Side Of The Moon_SPEAK TO ME.mp3"
"02-Pink Floyd-Dark Side Of The Moon_breathe in the air.mp3"
The user should have the possibility to enter the mask like this
%t-%a_%s (or <track />-<album>_<song>)
the programme should now parse the filename and set the params for track album and song. I've seen a mask editor in several programmes (e.g. Tag&Rename). If you could provide me with some more codesamples, that would be great (I'm a newbie to C++).
BTW, In a next step, our programme should analyze the filenames and suggest a mask by itself.
|
|
|
|
|
I have an MFC application where one of the dialogs can have 10 versions of it on display (multiple instances). I use a member variable to control the latest one called up, but would like this variable set to the current one; i.e. if the user clicks on display 2 I would like to make that one the current display.
Currently the varaible is set to the last one created, how do I set it to the current just clicked.
I know I can use:-
this->m_nCurrentDisplay;
but what event or message do I use.
Regards
|
|
|
|
|
how do I set it to the current just clicked.
I assume you are using modeless dialogs ?
you could handle CWnd::OnActivate ( WM_ACTIVATE ) or CWnd::OnSetFocus ( WM_SETFOCUS ) on the dialog, and have a variable in the parent window ( or the class that create the dialogs ) to hold the current dialog pointer ( or hwnd, ... ) .
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
I have asked a question to display dropdown menu when button is clicked.You have suggest me Foobar.asp application . I want to convert that button as a toggel type button.When button is clicked once it shows dropdown menu .Next time when it is clicked next time it should be clossed.
And one more thing i need the effect that when one button is clicked it display menu when we move to next button it should display next menu
Learner always
|
|
|
|
|
rver wrote:
You have suggest me Foobar.asp application .
I have?, man, I think I have to cut down on the booze...
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|