|
Well, I don't know, you could always open directly the ocx control with the ole/view utility that comes with VC++6, if you don't have that VC++ you can download it from Microsoft.
In that utility you can always choose the first option in the first menu and view the typelib (selecting the same ocx) and then you'll be able to see all that that control exports.
Then you shold be able to see how to do that.
An ActiveX control has it's members inside, so all the languages that must use it should be able to do it. A couple of weeks ago, I was not able to reach a couple of functions in an OCX from VC++2005 and in fact it was possible from Delphi.
Hope this helps.
|
|
|
|
|
I have a c++ codes for programming the parallel port to control an interfce circuit of 8 electrical devices.But this code did not work on WIN XP.how can convert these codes to visual c++ in order for me to incorporate inpout32.dll.Thanks
this is the code:
/*program to control devices using PC parallel port
The devices are controlled by pressing the keys 1-8
that corresponds to each of the 8 possible devices
*/
#include<dos.h>
#include<stdio.h>
#include<conio.h>
#define PORT 0x378 /* This is the parallel port address */
main()
{
char val=0,key=0;
char str1[]="ON ";
char str2[]="OFF";
char *str;
clrscr();
printf("Press the approriate number key to turn on/off devices:\n\n");
printf("Here Device1 is connected to D0 of parallel port and so on\n\n");
printf("Press \"x\" to quit\n\n");
gotoxy(1,8);
printf("Device1:OFF Device2:OFF Device3:OFF Device4:OFF\n");
printf("Device5:OFF Device6:OFF Device7:OFF Device8:OFF");
while(key!='x' && key!='X')
{
gotoxy(1,12);
printf("Value in hex sent to the port:");
key=getch();
switch(key){
case '1':
gotoxy(9,8);
val=(val&0x01)?(val&(~0x01)):val|0x01;
str=(val&0x01)?str1:str2;
printf("%s",str);
outportb(PORT,val);
gotoxy(1,13);
printf("%x",val);
break;
case '2':
gotoxy(21,8);
val=(val&0x02)?(val&(~0x02)):val|0x02;
str=(val&0x02)?str1:str2;
printf("%s",str);
outportb(PORT,val);
gotoxy(1,13);
printf("%x",val);
break;
case '3':
gotoxy(33,8);
val=(val&0x04)?(val&(~0x04)):val|0x04;
str=(val&0x04)?str1:str2;
printf("%s",str);
outportb(PORT,val);
gotoxy(1,13);
printf("%x",val);
break;
case '4':
gotoxy(45,8);
val=(val&0x08)?(val&(~0x08)):val|0x08;
str=(val&0x08)?str1:str2;
printf("%s",str);
outportb(PORT,val);
gotoxy(1,13);
printf("%x",val);
break;
case '5':
gotoxy(9,9);
val=(val&0x10)?(val&(~0x10)):val|0x10;
str=(val&0x10)?str1:str2;
printf("%s",str);
outportb(PORT,val);
gotoxy(1,13);
printf("%x",val);
break;
case '6':
gotoxy(21,9);
val=(val&0x20)?(val&(~0x20)):val|0x20;
str=(val&0x20)?str1:str2;
printf("%s",str);
outportb(PORT,val);
gotoxy(1,13);
printf("%x",val);
break;
case '7':
gotoxy(33,9);
val=(val&0x40)?(val&(~0x40)):val|0x40;
str=(val&0x40)?str1:str2;
printf("%s",str);
outportb(PORT,val);
gotoxy(1,13);
printf("%x",val);
break;
case '8':
gotoxy(45,9);
val=(val&0x80)?(val&(~0x80)):val|0x80;
str=(val&0x80)?str1:str2;
printf("%s",str);
outportb(PORT,val);
gotoxy(1,13);
printf("%x",(unsigned char)val);
break;
}
}
}
|
|
|
|
|
You need to create a low level driver, as modern operating systems do not normally allow you to access the hardware directly.
Good news: There is a freeware version that will allow you to do this; just install and call.
Bad news: I do not remember its name, but if I could find it while researching the subject, 5 years ago, so can you.
Good Luck!
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
|
hi all
i am undergoing a project which converts wave file to Mp3.
Inorder to design this audio format converter i am considering the mp3 algo which has following steps:-
1.divide the data into frames such that each frame lasts for 1 sec.
so by the field in header named bits per sample,i have divided the frames.for eg if bits per sample is 8 ie there will be 8 bits or 1 char in each frame and so on...........
in addition to this there are following steps:--
1.if two notes are played at a single time and they are exactly same,only one of them shoudl be retained.
2. if two notes are playing at the same time,but one is of higher freq and one is of lower,only higher one shoudl be retained.
i have traversed the wave header and accesed the data,but that data is in ascii form.
so on that data how can apply the above 2 steps. the wave header is also not giving me any help.
any help is welcome
|
|
|
|
|
puneet_cha wrote: i have traversed the wave header and accesed the data,but that data is in ascii form.
Huh? There may be some ASCII there, but there's more.
WAVE PCM soundfile format[^]
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
hi,
AM using Playsound to play a wave file with a click of a button,but if i want to control the volume with another button,is it possible? Pls advice for a step by step guide..
Thannks in advance
|
|
|
|
|
|
hi,
Am using PlaySound and due to some constraints am not able to use MCI.
Thanks
Pls advice
|
|
|
|
|
I successeded hooking the WSARec for read only:
I hooked the following:
INT WINAPI WSARecvHookProc(SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, LPDWORD lpNumberOfBytesRecvd, LPDWORD lpFlags, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
My question is how to write to the hooked buffer. I want to modify a packet with value 1 to 0
how can I rewrite the buffer with the value I want?
I am coding with c++ (VS2005)
Thanks in advance!
|
|
|
|
|
Hi, i got a problem with a program here and i cant find a good solution :/.
I have the process id's of some extern programs running, and i want to close them. But i really want to close them, no TerminateProcess(). The program should close them or send them a message to close, and then wait for the progress til it closed. Could anyone give me a hint about that? thx
|
|
|
|
|
|
but what if i dont know the name of the window, just the name of the exe file?
|
|
|
|
|
|
yes but that doesnt solve the problem, if the exe is called "something.exe", and this program creates a window with the titel "processing ...", im not able to identify the exe with a window handle. All i know is the name of the exe, and the path. With those infos i have to close the running program. Currently im using CreateToolhelp32Snapshot () to get a list of all running processes, and TerminateProcess () to close it. But thats to agressive, i want a clean close.
|
|
|
|
|
Are you spawning the .exe? If so, you should squirrel away the handle for when you are trying to close it.
Considering that it is always possible to have more than one process with the same name running, it's really a crap shoot anyway without a handle.
|
|
|
|
|
If you have the process ID, then you could use EnumWindows() to search through all top level
windows and for each window found, use GetWindowThreadProcessId() to look for a matching
process ID.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hello all,
I've tried to use the OnCtrlColor handler and return a different brush in order to change the background color, and also a different pen in order to change the text color, but none of them work with the checkboxes...
How should I do it in order to be able to change the text color?
As always thank you in advance.
|
|
|
|
|
Call SetTextColor() and SetBkColor() on the DC passed into OnCtlColor
Darker than a black steer's tookus on a moonless praire night
Within you lies the power for good, use it!!!
|
|
|
|
|
I was doing this and it did not worked for me...
HBRUSH CTAM_BODlgPaletStats::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if (GetFocus() == pWnd)
{
pDC->SetTextColor(RGB(255,0,0));
pDC->SetBkColor(RGB(0,255,0));
}
return hbr;
}
I've been trying to use those two functions, and they work fine for ll the editboxes and static controls in my dialog, but not for my checkboxes...
Any idea?
|
|
|
|
|
My bad.
A checkbox is a button, so it does not respond to WM_CTLCOLOR. You have to use the BS_OWNERDRAW style and do all the drawing yourself in response to a WM_DRAWITEM message.
Darker than a black steer's tookus on a moonless praire night
Within you lies the power for good, use it!!!
|
|
|
|
|
ah.. that was it...
I knew that the checkbox was a button but then...
in the MSDN help:
nCtlColor (->one of the parametes of the OnCtlColor)
Contains one of the following values, specifying the type of control:
<code>CTLCOLOR_BTN Button control</code>
CTLCOLOR_DLG Dialog box
CTLCOLOR_EDIT Edit control
CTLCOLOR_LISTBOX List-box control
CTLCOLOR_MSGBOX Message box
CTLCOLOR_SCROLLBAR Scroll-bar control
CTLCOLOR_STATIC Static control
well, who knows...
-- modified at 14:26 Saturday 28th April, 2007
I forgot to thank you for your feedback!
I'm searching for an alternative solution, so don't worry on that, I think is strange but...
|
|
|
|
|
|
Yes, I did not remember that class, some time ago I played a little with the CButtonST from Davide Calabro, it worked great, but I wanted to stick to "standard material", but I'll consider that, it worked really well some time ago.
Thank you for your feedback!
|
|
|
|
|
When I use this class to draw a picture in a timer function.
I find my free memory lose too fast!!
Who can help me !!
Thanks!!!
(My english is not very well!)
class CCarton
{
public:
CCarton();
virtual ~CCarton();
void Init( CWnd* pWnd );
void Draw( CDC* pDC, INT iX, INT iY );
private:
CBitmap m_bmp;
CBitmap *m_pOldBmp;
CWnd* m_pDrawWnd;
CDC m_dcSrc;
BITMAP bm;
};
CCarton::CCarton()
{
m_pOldBmp = NULL;
}
CCarton::~CCarton()
{
if( m_pOldBmp != NULL )
{
m_dcSrc.SelectObject( m_pOldBmp );
m_dcSrc.DeleteDC();
}
}
void CCarton::Init( CWnd* pWnd )
{
m_pDrawWnd = pWnd;
m_bmp.LoadBitmap( IDB_BITMAP );
m_bmp.GetBitmap( & bm );
CDC* pDC = pWnd->GetDC();
m_dcSrc.CreateCompatibleDC( pDC );
m_dcSrc.SetBkMode( TRANSPARENT );
m_pOldBmp = m_dcSrc.SelectObject( &m_bmp );
}
void CCarton::Draw( CDC* pDC, INT iX = 0, INT iY = 0 )
{
pDC->BitBlt( iX, iY ,bm.bmWidth, bm.bmHeight, &m_dcSrc, 0, 0, SRCCOPY );
}
// use draw at here !
void CBmpView::OnTimer(UINT nIDEvent)
{
m_Carton.Draw( GetDC(), 0, 0 );
CView::OnTimer(nIDEvent);
}
//initializing at here
void CBmpView::OnInitialUpdate()
{
CView::OnInitialUpdate();
m_Carton.Init( this );
}
-- modified at 6:26 Sunday 29th April, 2007
|
|
|
|
|