|
Greetings,
I was wondering if anyone knows how to do Audio Fading with Direct show?
I am trying to fade the audio of a file that is playing in a playlist type of app, are there any samples that I could look at?
Thanks in advance.
|
|
|
|
|
Please help,
In VB, the GetSpellingSuggestion() return a Set data structure, but in VC++ it returns LPDISPATCH.
VB function:
For Each wd In ActiveDocument.Words
Set sugg = wd.GetSpellingSuggestions
If sugg.Count <> 0 Then
For Each ss In sugg
MsgBox ss.Name
Next ss
End If
Next wd
Can anyone help me to deal with LPDISPATCH so I can get the result from the GetSpellingSuggestion method in VC++.
Thanks in advance
|
|
|
|
|
Hi;
I've been looking (texts, help, forums, the net) for something I assume is simple, but I can't find the "magic formula".
I would like to display any old Unicode character in a CRichEditCtrl. The language I support (Pali) uses Unicode characters over a very wide range in Unicode. My MS Word 97 can display the characters (using Insert Character). I can use the Unicode characters in my code, but I can't get them to display properly in the edit control (I get the default symbol). My font is "Arial Unicode MS".
Does anyone have a skeleton 1-2-3 for this?
BTW: a useful Unicode tool Unibook 3.0 is a free download at
http://www.unicode.org/unicode/onlinedat/resources.html
Thanks and peace from
Andy
http://members.home.net/j-andrew-shaw/
|
|
|
|
|
Hello, the codegurus around the world.;)
Try this.
This works to show Japanese in CRichEditCtrl.
BOOL CMyDialog::OnInitDialog()
{
CHARFORMAT cf;
CMyRichEditCtrl.GetDefaultCharFormat(cf);
cf.dwMask = CFM_CHARSET | CFM_FACE |CFM_BOLD | CFM_SIZE;
cf.dwEffects = CFE_BOLD;
cf.bCharSet = DEFAULT_CHARSET;
cf.yHeight =150;
CMyRichEditCtrl.SetDefaultCharFormat(cf);
Have a nice day.
-Masaaki Onishi-
|
|
|
|
|
#include<stdio.h>
void callDllFunc(char *, char *, ...);
void main()
{
char *szDllName = "USER32.DLL";
char *szFuncName = "SetWindowTextA";
char szDataType[40];
int numArgs, counter;
void *receptor[20];
printf("Enter the number of arguments SetWindowTextA takes: ");
scanf("%d", &numArgs);
for(counter = 0; counter < numArgs; counter++)
{
printf("Enter the datatype of arguement %d: ", counter+1);
scanf("%s", szDataType);
switch(*szDataType)
{
case 'i':
printf("Enter an int value: ");
scanf("%d", receptor[counter]);
break;
default:
break;
}
}
}
I want to take a variable number of arguments of any time. The user in this case wants to call a function within a Dll and he knows the number and types of the arguments. My problem is how do I take those arguments from the use and pass them on to the Dll? (callDllFunc will take the name of the Dll, the name of the function, and the arguments to be passed to the Dll function)
|
|
|
|
|
Can someone show me an example program on the use of the ellipsis (...) to be able to recieve an unspecified number/types of arguemtns at run time.
|
|
|
|
|
take a look at the MSDN for va_start, va_end or va_arg
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
I posted the following message a couple of days ago but haven't received a single reponse yet. I was wondering if it is the way I describe the problem or it is just too difficult to takcle with.
I am still struggling here hoping someone can point me to the right direction.
*******************************************************************
In my project, I declared a toolbar button structure TBBUTTON.
And loaded up some bitmap buttons dynamically into the toolbar by using toolBarCtrl.InsertButton( 0, &button ); in a for loop.
Then I set TBBUTTON's state and style as
button.fsState = TBSTATE_ENABLED;
button.fsStyle = TBSTYLE_BUTTON;
The problem now is that only 2 out of 10 buttons are being displayed on the toolbar. The rest of the buttons somehow got hidden in the back.
By resizing the window a little bit or toggling toolbar(show/hide), all the buttons get showed up. Obviously all the buttons are loaded up properly at run time but some buttons are just stay back invisible. If I drag and move the window around rather than tweaking the window size, those buttons are still hiding in the background.
Any thoughts what might caused this problem? Any suggestions on how to resolve that?
By the way, how I can modify my window's size just a tiny bit(I mean the SLIGHTEST change in either width or height. I wrote something like this, it solved that hidden button problem but the window gets changed the position too much.
CRect rect;
GetClientRect( &rect );
SetWindowPos( NULL, rect.left, rect.top, rect.Width(), rect.Height()+ 1/1000, SWP_NOZORDER | SWP_NOMOVE);
Thanks,
Allison
|
|
|
|
|
Are you calling RacalcLayout()?
|
|
|
|
|
I didn't call RecalcLayout(TRUE) before. But I just add that line into my code. It still does not help. What I am trying to do here is change window's size a little then resume it back to its original position without being noticed by end user. It is not working! Everytime I run the application, the window gets shrunk in its height. Any ideas? Thanx.
CRect rect;
GetClientRect( &rect );
int x = rect.left;
int y = rect.top;
int cy = rect.Height();
int cx = rect.Width();
// move RecalcLayout() after SetWindowPos(), still the same
RecalcLayout(TRUE);
SetWindowPos( NULL, rect.left, rect.top, rect.Width(), rect.Height()+ 1/1000, SWP_NOZORDER | SWP_NOMOVE);
// resume window to its previous position
SetWindowPos( NULL, x, y, cx, cy, SWP_NOZORDER | SWP_NOMOVE);
|
|
|
|
|
It is working now! Thanks for your suggestion.
Just put RecalcLayout(TRUE); No need to play with window size.
|
|
|
|
|
After toolbar initialization I call CToolBarCtrl::AutoSize()
|
|
|
|
|
Hi,
Maybe there is somebody who knows what may be wrong or has experienced the following problem:
I have an application which uses the PC's communication port. It uses "CreateFile" to create a virtual "file" on the comm port and simply uses WriteFile to write to it. Generally it works just great, sometimes for hours on end. Then all of a sudden the "WriteFile" returns an error in the same way it would do in case the "WriteFile" cannot be completed in one go . This is weird because I never send more then a few dozen bytes anyway and take care to space all transmission quite well. Still, I then use "GetOverlappedResult" to find out what is going on. Sure enough it says ERROR_IO_INCOMPLETE and keeps on doing so for ever. I have set up a timeout function on it to trap the condition and simply discard the outgoing message (there are plenty retries etc... at the higher application levels anyway). I perform "ClearCommError" and "CancelIo" to try and correct things but that does not always work. Sometimes having done it once the Writefile keeps giving back the same error continuously. having done it often enough this sometimes leads to the PC crashing quite spectacularly.
Anybody have any ideas or knowledge about this ? Any help would be most appreciated
Regards,
Filip
|
|
|
|
|
is there anything wrong with my 'for' statement here?
when i run the program, it says assertion failure... at line 222 of AFXCOLL.INL which is:
line 221: _AFXCOLL_INLINE CString CStringArray::GetAt(int nIndex) const
line 222: { ASSERT(nIndex >= 0 && nIndex < m_nSize);
CString sLevel;
int nCount;
for (int i=0; i <= 9; i++)
{
sLevel.Format("%d=", i);
CStringParser p3(sBufferList.GetNext(pos), sLevel); //parse RegisterList in lines of text
int nCount = p3.GetCount();
if (nCount > 0) //found more than one line of text in RegisterList
{
for (int j=2; j <= nCount; j++)
{
pos = sBufferList.AddHead(p3.GetField(j));
if (j>2)
ParseLevel(sBufferList.GetAt(pos), i);
}
}
}
please help!!
|
|
|
|
|
1 CString sLevel;
2 int nCount;
3
4 for (int i=0; i <= 9; i++)
5 {
6 sLevel.Format("%d=", i);
7 CStringParser p3(sBufferList.GetNext(pos), sLevel);
8 int nCount = p3.GetCount();
9
10 if (nCount > 0)
11 {
12 for (int j=2; j <= nCount; j++)
13 {
14 pos = sBufferList.AddHead(p3.GetField(j));
15 if (j>2)
16 ParseLevel(sBufferList.GetAt(pos), i);
17 }
18 }
19 }
1) You have nCount defined outside the scope of the "for" loop, as well as *inside* the scope. Is this really what you wanted?
2) You're passing a string in as a delimiter - it should actually be a single character. Onl line 6, your first delimiter is going to be a null character followed by an equal sign. I think what you wanted to do was extract a character from a string that contains several delimiters.
3) I never anticipated anyone using a NULL as a delimiter. I recommend you don't try it.
Looks like you're parsing a string that has several nested delimiters (HL7?)
|
|
|
|
|
1) the redefinition of nCount was a mistake, it is meant to be outside the 'for' loop.
2) I have modified the StringParser class to accept a CString argument instead of a char argument. Will it still work? and is this error due to the change?
please advise.
|
|
|
|
|
If you modified my original code, I can't really tell you if that's why it doesn't work unless I see the changes. By the way, there is an updated version I posted yesterday - is that the version you're using?
I've never seen delimiters that were multi-character strings. Can you describe the task you're trying to address with this code? Maybe we can come up with a different tack.
|
|
|
|
|
I want to parse a some text from a file. The format of the text goes something like this:
#BeginRegisterList
0= RegisterName A2 D2;
1= "Control Set";
2= Byte control &c5;
#EndRegisterList
I have converted the text from the file into a CString object, so that I can pass it into the StringParser functions.
I was able to use the modified StringParser class (I only changed the delimiter data type for "char" to "CString") to extract the lines between "#BeginRegisterList" and "#EndRegisterList" (I used these strings as the delimiter), leaving behind the following lines:
0= RegisterName A2 D1
1= "Control Set"
2= Byte control &c5
bit control
my problem arose at the point whereby I use a 'for' loop to extract the various parameters to be stored in the document:
RagisterName
2
1
Control Set
Byte Control
c5
bit control
the 'for' loop is to change the delimiter from "0=", "1=", ... "9=".
I hope the explanation is clear. I downloaded your code last week. will download the latest version now.
|
|
|
|
|
I'm leaving for work - I'll answer this when I get there. Do not dispair.
|
|
|
|
|
I have changed to the latest version and the 'for' loop works! I dunno what went wrong really. The old StringParser class still doesn't work.
Maybe you would like to take a look at the changes I made to your updated source code, using CString as delimiter. I have added another private member variable m_cDelimiterLen to adjust the workString for in the function CQStringParser::ParseString(). Will send the modified source files to your email.
|
|
|
|
|
I would use just the ' ' (space) character as the delimiter. This would result in the following:
//string 1
CStringParser("0= RegisterName A2 D2", ' ', '\"');
GetField(1) - "0="
GetField(2) - "RegisterName"
GetField(3) - "A2"
GetField(4) - "D2"
//string 2
CStringParser("1= /"Control Set/"", ' ', '\"');
GetField(1) = "1="
GetField(2) = ""Control Set""
GetField(2, TRUE) = "Control Set" // strip the quotes from the string
//string 3
CStringParser("2= Byte Control %c5", ' ', '\"');
GetField(1) - "2="
GetField(2) - "Byte"
GetField(3) - "Control"
GetField(4) - "&c5"
If you wanted to, it would be a simple matter (with the latest version of CStringParser) to modify the sub-strings (removing the '=' or leading spaces) by creating your own derived CStringParser class and handling the special cases as they arise without the need to change the underlying base class.
|
|
|
|
|
just wondering,
if I use a white space character ' ', the code does not detect the tabs spaces. Is there any way I can make the tab space(s) = a single white space?
Wat delimiter should I use if I want to parse my string into lines of text. Should the delimiter be the end-of-line (or is it some linefeed or CR character) character? If yes, what is the character?
Please provide me with some sample code if possible.
Thanks a lot!
|
|
|
|
|
I think your problem was with CStringArray(). I used CArrays() in my program and it was sometimes very hard to find out what causes the problem - one time it worked and one it doesn't. And even if you passed the same type of variables to it! I just had to rebuild the whole functions sometimes to make it work. Sometimes it worked if you rebiudl the whole project and sometimes when you restart VS - maybe it uses some kind of cache memory?
Microsoft knows.
Greets,
|
|
|
|
|
Hi
I'm a Korean..
How to control the other program(for example, MS Word, Internet Explore etc...)'s scrollbar?
For example, when any button in my program is clicked,
my program want to know other program's scrollbar's "range"(or page, position) in client area.
how to???
|
|
|
|
|
Why on earth would you want to do *that* ?
If you enumerate the windows in some manner you can get the CWnd of another Window, then I presume you can call SetScrollPos, etc.
Christian
I've learned that you cannot make someone love you. All you can do is stalk them and hope they panic and give in.
The early bird may get the worm, but it's the second mouse that gets the cheese.
|
|
|
|