|
Hi,
In my VC applications, i need to use static members and methods for a callback function. The dialog was modal. Now i need to change the dialog as modeless. Does the static members would affect the display of results that are from the callback functions?
The result from the callbacks are inserted in the list control.
The problem am facing is , after converting the dialog to modeless, if i open the dialog (more than 1), the result from the callback is displayed in one only dialog.
Please clarify.
Thanks
Raji
|
|
|
|
|
Can you show some code for your explanation ?
|
|
|
|
|
All the dialog instances are going to share the static variables.
If the list control is static then you have a problem - each instance of the dialog needs its
own list control object because each will have its own HWND.
If the callback is setup from in the dialog class, then is there a way you can have the callback
called with some parameter to differentiate between the different dialog instances (like a pointer
to a dialog object)?
Mark
|
|
|
|
|
List control is not static.
Thanks
Raji
|
|
|
|
|
What is not working then?
|
|
|
|
|
Hi,
I want my application will be displayed in Multiple language without creating
dialogs each one for each language.
How can i do it?
|
|
|
|
|
Refer localization [^] section of this site.
You will get good idea , how to acheive this.
|
|
|
|
|
Adding to the above reply, make sure your application is unicode aware. Store literal strings to be displayed in a string table instead of hard-coding. Then load them accordingly.
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
My Application is unicode aware. And also i loaded strings from string table. Now i put the menu which is for displaying different languages.
Now what i want is when i click chinese ,the GUI will be displayed in chinese.. how can i do it ?
|
|
|
|
|
|
Do you care to read links provided to you ?
|
|
|
|
|
|
i need to know if there is a api for the copy command used in cmd window
ex.. copy /b file1 + file2 output file
|
|
|
|
|
|
ok ive been trying copyfile but how do i make it join 2 files?
somemovie cd1.avi + somemovie cd2.avi = 1 joined avi file?
|
|
|
|
|
|
I serialized data to a file. Data file consists of many lines, so each has it's carriage return at the end. The problem is, the reader cannot pickup the carriage return. My observation is, when I open the file with Notepad++ or Wordpad, you can visually see the carriage return. When open with notepad (and my application's reader class), the carriage return isn't picked up.
Here's the code extract ...
1. Writing to data file
<br />
CFile oFile;<br />
oFile.Open("...", CFile::modeCreate|CFile::modeWrite|CFile::shareDenyWrite);<br />
<br />
for(int nIndex=0; nIndex<nSize; nIndex++) {<br />
strLine = oLines.GetAt(nIndex);<br />
<br />
strLine += L"\n";<br />
iLen = strLine.GetLength();<br />
pMultiByteStr = new char[iLen]; <br />
WideCharToMultiByte(CP_ACP, 0, (LPCWSTR) strLine.GetBuffer(iLen), -1, pMultiByteStr, iLen, "", &bUsedDefaultChar);<br />
oFile.Write(pMultiByteStr, iLen);<br />
}
2. Reading from data file [It simply read one line and exited]
<br />
int CSomeClass::ReadThisFile{<br />
int iCount = 0;<br />
CString sLine;<br />
CStdioFile oFile;<br />
<br />
try<br />
{<br />
if (!OpenFile("..."))<br />
return 0;<br />
<br />
if (m_bHeaderRow)<br />
oFile.ReadString(sLine);<br />
<br />
while (oFile.ReadString(sLine))<br />
{<br />
if (sLine.GetLength() > 0)<br />
iCount++;<br />
} <br />
oFile.Close();<br />
}<br />
catch (...)<br />
{<br />
...<br />
}<br />
<br />
return iCount;<br />
}<br />
Any clue? Thanks
|
|
|
|
|
What if you try a carriage-return/linefeed pair?
strLine += L"\r\n";
|
|
|
|
|
It works Lord Salsbery!!
Norman Fung
|
|
|
|
|
Project-->Link:winmm.lib
#include "mmsystem.h"
BOOL GetRecordradio()
{
UINT m_uMxId2;
//HWND m_hWnd;//回调句柄
HMIXER m_hmx2;
MIXERCAPS mxcaps;
//返回系统中混音器数量(如:一块普通声卡提供一个混音器设备)
int devnum=mixerGetNumDevs();
int i=0;
for(i;i<devnum;i++)
{
m_umxid2=i;
if (mmsyserr_noerror="" !="
mixerOpen(&m_hmx2," m_umxid2,null,="" 0,="" callback_window))
="" 使用dwcallback参数
return="" -1;
="" 得到相应设备标识号
="" mixergetid((hmixerobj)m_hmx2,&m_umxid,mixer_objectf_hmixer);
="" 确定各混音器设备的能力:保存在mxcaps结构中(wmid,wpid,szname,cdestinations)
if="" false;
="" 检索指定音频线路的信息,保存在mixerline结构中,
="" 其中一些成员根据不同情况要初始化
mixerline="" mxl;
mxl.cbstruct="sizeof(MIXERLINE);" 必须赋值
="" 可以通过多种条件来检索:
="" 方式一:根据目标单元编号
="" mxl.dwdestination="0;等同用mxl.dwComponentType=MIXERLINE_COMPONENTTYPE_DST_SPEAKERS
//mxl.dwDestination=1;等同用mxl.dwComponentType=MIXERLINE_COMPONENTTYPE_DST_WAVEIN
//对应flag:" mixer_getlineinfof_destination
="" =="" mixerline_componenttype_dst_wavein;
="" 对应flag:="" mixer_getlineinfof_componenttype
if="" (::mixergetlineinfo((hmixerobj)m_hmx2,
&mxl,
mixer_objectf_hmixer="" |
mixer_getlineinfof_componenttype)
!="MMSYSERR_NOERROR)" return="" 查询="" 录音控制面版中="" 麦克风线路的编号=""
mixerline="" mxl_v;
uint="" cconnections="(UINT)mxl.cConnections;
UINT" dwsource_v="0;
do
{
mxl_v.cbStruct" sizeof(mxl_v);
mxl_v.dwdestination="mxl.dwDestination;
mxl_v.dwSource" dwsource_v;
dwsource_v++;
if=""
&mxl_v,=""
mixer_getlineinfof_source))
return="" false;
}="" while="" ((dwsource_v="" <="" cconnections)="" &&=""
(mxl_v.dwcomponenttype=""> cConnections) ||
(mxl_v.dwComponentType !=MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE))
return FALSE;
dwSource_v--;//得到编号
//下面这段文字说明在本例中已经没有什么实际意义,是以前调试时留下的,也不删除了,
//可以知道如何控制主音(Volume)线路的禁音状态:
//--可以利用得到的主音(Volume)线路的mxl.dwLineID,
//来查询Volume的禁音状态
//要想查询(或设置)可以混音到DST_SPEAKERS主音(Volume)中的
//相关音源线路(如:wave、micphone等)的禁音状态,还必须再使用
//一次 mixerGetLineInfo 进一步指定其dwLineID
//注意:不要简单的直接修改上面的:
//mxl.dwComponentType = 类型;
//虽然可能有时不会报错,但这成了我们程序中的隐患,
//因为有的线路在DST_SPEAKERS和DST_WAVEIN中均有,如:
//MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC
//下面实现了"强制"单选麦克风线路为录音源输入
MIXERCONTROL mxc;
MIXERLINECONTROLS mxlc;
mxlc.cbStruct = sizeof(MIXERLINECONTROLS);
mxlc.dwLineID = mxl.dwLineID;
mxlc.dwControlType = MIXERCONTROL_CONTROLTYPE_MUX;
//MIXERCONTROL_CONTROLTYPE_MUTE;
mxlc.cControls = 1;
mxlc.cbmxctrl = sizeof(MIXERCONTROL);
mxlc.pamxctrl = &mxc; //为了得到相应的mxc.dwControlID,
//锁定mxlc.dwLineID和mxlc.dwControlType指定的线路控制
//目前将对录音目标单元的录音音源线路做单选(多路复用)
if (::mixerGetLineControls((HMIXEROBJ)m_hmx2,
&mxlc,
MIXER_OBJECTF_HMIXER |
MIXER_GETLINECONTROLSF_ONEBYTYPE)
!= MMSYSERR_NOERROR) return -1;
//根据mxc.dwControlID检索线路,
MIXERCONTROLDETAILS_BOOLEAN mxcdMute[8];
MIXERCONTROLDETAILS mxcd;
mxcd.cbStruct = sizeof(MIXERCONTROLDETAILS);
mxcd.dwControlID = mxc.dwControlID;//在上面的&mxc得到
mxcd.cChannels = 1;
mxcd.cMultipleItems =mxc.cMultipleItems;//多路因子数目
mxcd.cbDetails = sizeof(*mxcdMute);
mxcd.paDetails =&mxcdMute;//存放检索结果
if (::mixerGetControlDetails((HMIXEROBJ)m_hmx2,
&mxcd,
MIXER_OBJECTF_HMIXER |
MIXER_GETCONTROLDETAILSF_VALUE)
!= MMSYSERR_NOERROR) return -1;
//做相应单选改变
int j;
for(j=0;j<(int)mxc.cMultipleItems;j++)
mxcdMute[j].fValue=false;
mxcdMute[dwSource_v].fValue=true;
//重新设置dwControlID锁定的线路控制
if (::mixerSetControlDetails((HMIXEROBJ)m_hmx2,
&mxcd,
MIXER_OBJECTF_HMIXER |
MIXER_GETCONTROLDETAILSF_VALUE)
!= MMSYSERR_NOERROR) return -1;
}//for(i;i
|
|
|
|
|
I need to convert a COLORREF value to 3 COLOR16 (hex) values. I'm trying to fill out this structure:
typedef struct _TRIVERTEX {
LONG x;
Long y;
COLOR16 Red;
COLOR16 Green;
COLOR16 Blue;
COLOR16 Alpha;
}TRIVERTEX, *PTRIVERTEX;
GetRValue, GetGValue, and GetBValue will give me color intensity integers, but those need to be converted to hex values. So to be more precise I need to convert from an integer to a COLOR16 hex value. Anyone got ideas?
|
|
|
|
|
From the docs:The color information of each channel is specified as a value from 0x0000 to 0xff00. So you can take the one-byte value from the COLORREF and multiply by 256.
|
|
|
|
|
How do I take the 1 byte value from it?
|
|
|
|
|
It's the value returned by GetXValue:
COLORREF cr = RGB(64,128,196);
BYTE red = GetRValue(cr);
COLOR16 red16 = red * 256;
|
|
|
|
|