|
And writing in standard basic will be accepted by the VC++? Just some changes and compile in VC 6?
That would be great, to save so much time, will save my own ass :P I will be able to concentrate in the PLC-programm. If I have time at the end... I will try to make my own DLL to comunicate through Ethernet insteads of Serial-MPI to learn about the thema, but when my placement is not in danger.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
probally this could help
http://www.freevbcode.com/ShowCode.asp?ID=3492[^]
It is an exaple on how write a c++ dll and use it in basic, so it is the opposite case.
But, in your case, the sintax that yiu have to use, must be the same(I think)!
Russell
|
|
|
|
|
Thanks a lot for the link, I will save it favourites. I don't really like VB but many applications that we use in the firm need scripting in VB, so soon or late I will must learn it.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Hi all,
I want to display the waveform of wav file selected on the dialog.If there is any application or code for reference.Actually i am not able to read the wav file properties and adjust it according to dialog size.
Regards,
Mayank
|
|
|
|
|
Have a look at the Audacity source code.
I will let you google for it; don't worry, it's open-source code.
|
|
|
|
|
when I run the code,it says a wrong about EMS,please help
#include<iostream>
using namespace std;
void two(int k)
{
int x,i=1,n;
int p1[100],p2[100];
while(i)
{
i=k/2;
x=k%2;
k=i;
p1[n]=x;
n++;
}
cout<<n<<endl;
for(int="" a="0;n">0;n--,a++)
{
p2[a]=p1[n-1];
//cout<<p2[a];
cout<<p2[a];
="" }
=""
}
void="" main()
=""
{="" int="" a;
="" cin="">>a;
two(a);
}
|
|
|
|
|
First of all you don't initialize the variable 'n' in your code. so p1[n] is an invalid location. When you try and store a value at that place it would be throwing an error or possibly a crash. Can you just check if this is the root cause?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
thank you .i have find it .a little mistake led on to a great error.
|
|
|
|
|
hey hi all... i made a c++ program in which i need to detect USB device inserted event... but my windowProc function is not getting called.. i don't know whats wrong with the program.... i also tried to check the error by using GetLastError() but i got nothing.. code goes like this
#ifdef WINVER
#undef WINVER
#endif
#define WINVER 0x0501
#include
#include
#include
#include
#include
DEFINE_GUID(GUID_DEVINTERFACE_VOLUME, 0x53f5630dL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
// don't know if this is the correct GUID for USB device interface... i got it from MSDN website....
#define guid GUID_DEVINTERFACE_VOLUME
using namespace std;
HDEVNOTIFY RegisterDeviceNotificationA(
HANDLE hRecipient,
LPVOID NotificationFilter,
DWORD Flags
);
#define RegisterDeviceNotification RegisterDeviceNotificationA
LRESULT CALLBACK WindowProc(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // device-change event
LPARAM lParam // event-specific data
);
int main( )
{
HWND hwnd = FindWindow( "ConsoleWindowClass", NULL);
cout<<hwnd<<endl; to="" check="" if="" im="" able="" get="" hwnd="" or="" not......
dev_broadcast_deviceinterface="" notificationfilter;
zeromemory(="" ¬ificationfilter,="" sizeof(notificationfilter)="" );
notificationfilter.dbcc_size="sizeof(DEV_BROADCAST_DEVICEINTERFACE);
NotificationFilter.dbcc_devicetype" =="" dbt_devtyp_deviceinterface;
notificationfilter.dbcc_classguid="guid;
HDEVNOTIFY" hdevnotify;
hdevnotify="RegisterDeviceNotification(" hwnd,="" device_notify_window_handle);
cout<<hdevnotify<<endl;="" the="" value
if(="" !hdevnotify="" )
{
cout<<"registration="" of="" device="" notification="" failed"<<endl;
}
else
{
cout<<"registration="" complete"<<endl;
}
dword="" dword;
dword="GetLastError(" );
cout<<dword<<endl;="" for="" any="" error="" any....
while(1)
{
sleep(1000);
}
return="" 0;
}
lresult="" callback="" windowproc(="" uint="" umsg,="" wparam="" wparam,="" lparam="" )
{
cout<<"windowproc="" called"<<endl;="" its="" getting="" called="" not.......
if(="" umsg="=" wm_devicechange="" )
{
cout<<"device="" change"<<endl;
}
return="" defwindowproc(hwnd,umsg,wparam,lparam);="" call="" window="" api="" function="" defwindowproc()="" which
="" provides="" default="" message="" processing="" messages="" that="" were="" not="" processed="" by="" this="" window.
}
output="" is
0x290392="" hwnd
0x245d08="" hdevnotify
registration="" complete
0="" getlasterror()
and="" nothing="" is="" happening="" when="" inserting="" usb.....nyone="" knw="" about="" this
bye="" have="" a="" nice="" day.....=""
<div="" class="ForumSig">bye have a nice day.....
|
|
|
|
|
$w0rdf1$h wrote:
HDEVNOTIFY RegisterDeviceNotificationA(
HANDLE hRecipient,
LPVOID NotificationFilter,
DWORD Flags
);
#define RegisterDeviceNotification RegisterDeviceNotificationA
Why are you re-prototyping this function?
$w0rdf1$h wrote: ...my windowProc function is not getting called.
Why would you expect it to?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
my compiler was saying.... registerDeviceNotification() undeclared.... so i search google.. n put this frm there... now i also tried without prototype.. with correct header files inclueded.. now i am not getting that error but my program is also not working..im not getting any notification.....i can do this using win32 api with winMain() as entry point in place of main().. but point is that i want my program to run in background....i can hide console using ShowWindow(hwnd,1) but i dont know how to hide top level window created in winMain()?????
bye have a nice day.....
|
|
|
|
|
$w0rdf1$h wrote: my compiler was saying.... registerDeviceNotification() undeclared
And rightly so, since registerDeviceNotification() does not exist.
$w0rdf1$h wrote: ...but my program is also not working..im not getting any notification...
Why would you expect to?
$w0rdf1$h wrote: i can do this using win32 api with winMain()...
Probably so (assuming you capitalized it correctly), since it likely has a message pump.
$w0rdf1$h wrote: i want my program to run in background...
What does that have to do with using main() in place of WinMain() ?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
see i found it on MSDN that function registerDeviceNotification(...,...,... )
registers for windows service that sends notification to window whose HWND is registered( passing it as a parameter)....and its a function in WIN32 API.. so y should i get a no such function exist error...
see this...
http://msdn2.microsoft.com/en-us/library/aa363431.aspx[^]
bye have a nice day.....
|
|
|
|
|
C++ is case sensitive, so registerDeviceNotification is not the same as RegisterDeviceNotification.
|
|
|
|
|
yaa i knw.... im srry i posted in forum registerDeviceNotification(..)... but i the one i used in my program is RegisterDeviceNotification(...)... u can see it in my first post....
bye have a nice day.....
|
|
|
|
|
Could you please write in proper english ? A lot of people here are not native english speaker and deciphering SMS messages is really a pain.
For your question: did you include Winuser.h ?
And, why do you want absolutely use windows API in a console application. You don't have a message loop so how could you receive windows notification messages ? David already told you so.
Why don't you simply create a Win32 app, create a window and don't show it ?
|
|
|
|
|
ohh sorry... i will take care of that in future......
Now I am using WinAPI and not using console.....
i have created a window and hide it using showWindow(hwnd,0) and this is working fine...now no need to panic... thanx....
bye have a nice day.....
|
|
|
|
|
Can anybody help me help me to remove and add Caption Bar of a dialog at runtime.
I have created a dialog through resource with a caption bar.
I want to remove completely the caption on clicking the Button1 on the dialog and add the caption bar on click of button2 on the dialog.
Though on click of Button1 the caption bar is still there but the dialog is not movable whereas when i click Button2 I am able to move the dialog on selecting the Caption bar.
Can anybody suggest the way where the caption will be completely removed and caption appears as per our requirement.
void CCaptionWndDlg::OnButton1()
{
ModifyStyle(WS_BORDER|WS_CAPTION,0);
CRect aRect;
GetWindowRect(&aRect);
::SetWindowPos(m_hWnd,HWND_TOP,aRect.top,aRect.left,aRect.Width(),aRect.Height(),SWP_NOZORDER | SWP_NOACTIVATE);
}
void CCaptionWndDlg::OnButton2()
{
ModifyStyle(0, WS_BORDER|WS_CAPTION);
CRect aRect;
GetWindowRect(&aRect);
::SetWindowPos(m_hWnd,HWND_TOP,aRect.top,aRect.left,aRect.Width(),aRect.Height(),SWP_NOZORDER | SWP_NOACTIVATE);
}
|
|
|
|
|
naveen.V wrote: ::SetWindowPos(m_hWnd,HWND_TOP,aRect.top,aRect.left,aRect.Width(),aRect.Height(),SWP_NOZORDER | SWP_NOACTIVATE);
replace with
::SetWindowPos( m_hWnd, 0,0,0,0,0, SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_DRAWFRAME );
|
|
|
|
|
Thanks a lot.Its Working!!!!!
|
|
|
|
|
Thanks a lot Naveen.. SWP_DRAWFRAME did the trick.
|
|
|
|
|
Naveen.R wrote: ::SetWindowPos( m_hWnd, 0,0,0,0,0, SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_DRAWFRAME );
FYI: SWP_DRAWFRAME can be specified in the ModifyStyle itself
- NS -
|
|
|
|
|
NS17 wrote: FYI: SWP_DRAWFRAME can be specified in the ModifyStyle itself
Ya I forgot. BTW ModifyStyle() internally does the same thing...
|
|
|
|
|
The following code will do the trick...
void CCaptionWndDlg::OnButton1()
{
ModifyStyle( WS_BORDER | WS_CAPTION, 0, SWP_DRAWFRAME );
}
void CCaptionWndDlg::OnButton2()
{
ModifyStyle( 0, WS_BORDER | WS_CAPTION, SWP_DRAWFRAME );
}
- NS -
|
|
|
|
|
Thanks a lot.Its Working!!!!!
|
|
|
|