|
In BNF statement, there is a symbol can express "empty" meaning.
But I don't know how to express "empty" meaning in YACC decription file?
I'm amumu, and you?
|
|
|
|
|
I'd say it is more or less like this:
emptyrule :
; but I could be totally wrong
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi,
I am pretty new to VC++, I mainly use it to create small dialog-based apps using the Windows API. However, at the moment I am trying to create a progress bar using the CProgressCtrl with a window created using CreateWindowEX() (I don't want to use the normal CreateWindow...PROGRESS_CLASS method for the bar as I want to use an extended class that can create a progress bar with gradient colours). This sounds stupid, but I am completely stumped on how to create a progress bar this way. My problem seems to lie with the difference between CWnd and HWND. The parent window that I want to use for the control is not a dialog, but has been created using CreateWindowEx(), and I can't find any examples on the net of how to do this properly (all the examples I can find relate to dialog-based apps). This is the code I am trying to use:
CProgressCtrl MyProgressBar;
CWnd *parentwindow = CWnd::FromHandlePermanent(hwnd);
//hwnd = windows window created using CreateWindowEx()...
MyProgressBar.Create(WS_VISIBLE|WS_CHILD|PBS_SMOOTH,CRect(10,10,200,30),parentwindow,1);
This is all in WinMain(). Everything compiles okay, but when I run the executable I get an assertion error (line 19 of afxwin1.inl, or some such) and of course, there is no sign of the progress bar.
If anyone could tell me what I am doing wrong (and I know it's something really stupid owing to the fact that I'm a novice programmer), I would be very grateful.
Many thanks,
Keith
|
|
|
|
|
This is all in WinMain()
I guess this is where the problem lies. If you're dong raw Win32 apps (which provide of a WinMain ) you've got no MFC support. CProgressCtrl is an MFC class, so it's on wonder nothing works. Create a new project and select the "MFC app" type (or something like that.) The way of writing programs changes from what you're used to, but it doesn't take long to get a passing idea of how it works.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi, thanks for your reply. I've got my program set up so that it's using "MFC in a shared DLL", and there I no errors when I compile. Is it the case that you can't use MFC and WinAPI together? Sorry for the dumb question, but I've never used MFC before. If that's the case I guess I'll have to get learning MFC, unless there is some way of using a gradient coloured control bar in WinAPI (it's the only feature I need to add to my program...).
Again, thanks for your help.
Cheers,
Keith
|
|
|
|
|
Keith, imho you're much better off using MFC (as Joaquín suggested). You could then just use this class.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Thanks for your reply. That's actually one of the classes I was looking at using. Looks like I'll have to go away and learn MFC...
Thanks again,
Keith
|
|
|
|
|
How can I use drag'n drop to get the HWND of the target application window? Is it possible ?
thx
<view next="">
|
|
|
|
|
WindowFromPoint(CursorPos);
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
|
Hello,
I need to use a dll file (that I downloaded from the net) in my MFC VC++ application, but I am new to dll's and VC++ and don't know where to start. I was hoping that someone knew of a document that I could read that would show me how to do this.
Thanks,
Aoife
|
|
|
|
|
What kind of a DLL you have downloaded,
and how do you intend to use that..
|
|
|
|
|
Typically, the DLL is going to come with a header file and an import library.
1) Simply include the header file where you need to - either in the file that will be references any of the DLL's exported types or functions) or in the stdafx.h file
2) Add the import library to the project.
3) Place the DLL in one of the following folders
(This is the order windows searches for DLLs)
The current folder
The Windows folder
The Windows system folder
The folder where the main application is being run from
The folders listed in the PATH environment variable
A mapped network folders
Let me know if you need any more help.
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|
|
If the DLL doesn't come with an import lib, you can get at an exported function by using GetProcAddress() . However, you'll still need a .h file that describes the function's prototype.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hello.
I have a problem sending packets at the right time. My app sends a packet (16-100kbytes) each 10 seconds... but they are paired up and received as 2 packets each 20 seconds. I used setsockopt with no_delay set to 1 and it didn't help. My send buffer is 8192 bytes, I use win98 and winsock 1.1
How can I force winsock to send each packet separately ?
Any help would be appreciated...
|
|
|
|
|
Hi,
Actually, it might be that the packets are buffered and
sent when buffer is full (normal behavior)..
So you have to flush the data from the buffer
so that it writes the data.
Sameer
|
|
|
|
|
Yes, that's what I am trying to do...
Do you know how to flush the data using windows sockets 1.1 ?
I think I should switch to winsock version 2.2, there is a SIO_FLUSH command in WSAIoctl()... anyone used that with positive outcome ?
|
|
|
|
|
Winsock buffers data, but does not wait as long as 10 seconds (by default, it's buffering time, i.e. the time it waits for more data before flushing to the net, is 100 ms.) So I'd say the problem is somewhere else.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Yeah, you were right... the problem was one else statement which somehow got commented out and I don't know why...
Thanks m8 I was almost ready to switch to w2k ...
|
|
|
|
|
Hi,
I've created a DLL and exposed two functions InstallHook
and DeleteHook
Actually one of my application hooks this dll for getting
the application which have started on my computer
The problem is that, i am writing all that in a
log file (a simple .txt file), but the filename is
Hard Coded. How can i make this filename such
that, my dialog based application which is actually
initiating this DLL pick up this filename.
|
|
|
|
|
Pass the filename along as a command line parameter. Read this parameter in your InitInstance using CCommandLineInfo (for example.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi,
I can't pass any arguments..
Actually i have an MFC application which inturns just calls
the Install Hook function, which in turn sets the hook
to the system..
So even if i pass argument to Installhook, it cannot send the argument to my DLLMAIN function..
|
|
|
|
|
Is there enough interest in MC++ to warrant a separate forum?
cheers,
Chris Maunder
|
|
|
|
|
YES!
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|
|
I've not seen a lot of MC++ questions asked in the C++ forum so I'm not sure the demand is there yet. If there isn't a lot of work to add the new forum then there is no reason why a seperate forum can't be created, I'm just not sure that people still wouldn't post the questions in the C++ forum as that is the one which will get the most views.
Michael
|
|
|
|