|
Thanks Michael,
That worked like a charm
Regards
Wim
|
|
|
|
|
Hi all,
I am currently designing a plug-in architecture and I am looking for advice on how to go about sending messages to a given plug-in or all plug-ins. I would be sending messages for keypresses, mouse clicks, etc.
Thanks,
Steve
|
|
|
|
|
If your working on an MFC program, I have a library that allows plug-ins here http://www.codeproject.com/library/piarchitecture.asp[^]
That handles all the kind of stuff your talking about.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
Roger,
Thanks, I did't think to look in the library section... but thanks I will have a look
Steve
|
|
|
|
|
Roger,
This is overwhelming. Do you have an example project using a dialog application. I don't need hardly any of what your library is doing. I am only using a dialog base application and all the plug-ins will be dialog based as well.
Thanks,
Steve
|
|
|
|
|
i wrote:
m_DLG.m_rate = recordset.GetFieldValue("rate").dblVal;
even though my m_rate is a float type, when i compile i get the error warning C4244: '=' : conversion from 'double' to 'float', possible loss of data.
i tried to use fltVal and other database conventions but the values will appear distorted. although i get this warning, the data value appear correctly when just wanna knoe if can resolve this.
|
|
|
|
|
|
Try Casting the value type:
m_DLG.m_rate = (float)(recordset.GetFieldValue("rate").dblVal);
This should convert the double to a float making the assignment acceptable to the compiler. Note it is possible to lose accuarcy of the information as float has smaller limits than double.
|
|
|
|
|
thanx! the compiler accepts it now
|
|
|
|
|
i wrote:
m_DLG.m_rate = recordset.GetFieldValue("rate").dblVal;
even though my m_rate is a float type, when i compile i get the error warning C4244: '=' : conversion from 'double' to 'float', possible loss of data.
i tried to use fltVal and other database conventions but the values will appear distorted. although i get this warning, the data value appear correctly when jua wanna knoe if can resolve this.
|
|
|
|
|
a) recordset.GetFieldValue("rate") gives a variable of variant type, which means that it can hold a value of one of a set of types. The type it actually hold is in the .vt member. If you access the wrong one for the type, then it comes out as garbage (for reasons why, take a look at the union construct).
b) .dbvVal returns a double , yet your m_rate is a float . float variables take up a smaller size than double (in VC++, float is 4 bytes, double is 8) - this means that some of the precision of the double is lost in the converstion to float .
So you need to check the type of the variant before accessing it, and you need to store the result in an appropriately typed variable, or cast it.
--
Ian Darling
"The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky
|
|
|
|
|
Ian Darling wrote:
So you need to check the type of the variant before accessing it, and you need to store the result in an appropriately typed variable, or cast it.
Or there's always VariantChangeType[^].
|
|
|
|
|
I want to analyze C++ source code(VC) and Java source code. To know classes relationship. How to use yacc and lex to do this? Have any C++ parse or Java parse for this purpose?
|
|
|
|
|
Ah, something on which I have experience
In the final year of my degree, I had to select an individual project. One of the projects offered was to produce an application to draw diagrams of the static structure of an input program - I selected this project.
Subsequently I discovered that it's extremely hard to write a C++ parser. A Java parser isn't a lot easier. My difficulties in writing the parser basically meant that the rest of the application never got written, and I damn near failed the project.
Anyway, while trying to write it, I posted numerous questions and progress reports on various Usenet newsgroups. The best way to read it all is to Google[^] for it.
See also http://www.nobugs.org/developer/parsingcpp/[^].
Since then, I've come to the opinion that you should use the most powerful tools possible when parsing C++ - ones that cope with the ambiguity inherent in the language. The general name for this type of tool is a 'Generalised LR' parser - often abbreviated GLR. Elkhound[^] looks quite interesting.
As for me, I'm steering well clear of parsing for the meantime. I think the understanding of C++ I got from trying to parse it was quite helpful, anyway.
For either language, you'll want to get hold of the appropriate specification. For Java, the specification is The Java Language Specification[^]. For C++, it's ISO 14882[^] (which has rocketed in price - this used to be $18! - although you may find a copy on the web somewhere.)
|
|
|
|
|
Mike Dimmick wrote:
One of the projects offered was to produce an application to draw diagrams of the static structure of an input program
Wow. Your lecturer must've really had a sense of humour
"Sucks less" isn't progress - Kent Beck [^]
Awasu 1.1.2 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Taka Muraoka wrote:
Your lecturer must've really had a sense of humour
The irony being that he was the lecturer teaching the Programming Language Implementation course (i.e. the how-to-build-a-compiler course).
The set work for that course involved writing a compiler for an extremely simple language which could be parsed quite easily with a recursive-descent LL(1) algorithm, unlike virtually every practical high-level language ever created.
Pascal and Ada can be parsed with a slightly fudged LL(1) parser (Ada has a .. operator which requires the lexer to distinguish between 5.2 as a single floating point literal, or 5..2 as the separate tokens int-literal double-dot-operator int-literal) but programmers used to C++ tend to hate such languages, because there are keywords everywhere.
Much as C++ is hard to parse for computers, and sometimes for humans, if we limit ourselves to simple uses of the syntax, it's often quite quick to express a particular algorithm. I find I'm more productive in expressing an algorithm in C++ than I am in Visual Basic, for example - less to type. However, the GUI libraries are generally not so easy to use from C++.
Having said that, the GUI libraries in C++ usually have far more power - if you need to do something differently from how VB does it, it's much harder. I suppose you could say that in C++, we have a steeper initial learning curve but it requires less effort to add something harder, while with other tools you have a shallower initial curve, but then practically hit a brick wall.
|
|
|
|
|
I tried writing one in about '96 and gave up - it was just too hard. And that was without worrying about templates. I can't bear to think what it must be like now! :cry:
I wanted to have something that analyzed source code since I am/was a contractor and move around jobs a lot - you're expected to be productive from day one. I ended up just writing a wrapper around ctags
Those links you gave were excellent, btw. Thanks.
"Sucks less" isn't progress - Kent Beck [^]
Awasu 1.1.2 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Thx for your information. I will see the tools to help me builder a parser.
Thx again.
|
|
|
|
|
Hi all, I have a custom installer application for my driver. During the installation, it also creates a dialup entry. This works fine in WinXP and Win2K.
But in Win98SE, the call RasSetEntryProperties() always returns fails, with an error code of 0x6f8. I tried finding what this error code means, but to no avail. The function RasGetErrorString(), when passed this error code, fails with an error code of 87.
I am stuck here. Any ideas or suggestions on this problem is really appreciated.
|
|
|
|
|
Please remove [nospam] from my email ID for replying. I dont know why, but the forums is not allowing me to modify my msg anymore; says "You are not authorised to modify/delete". I guess, because of the email IDs mismatch, this error is coming.
---------
Kannan Ramanathan
kannan.ramanathan@st.com
|
|
|
|
|
I know number 87 - it's ERROR_INVALID_PARAMETER .
I think error 0x6f8 (decimal 1784) should be interpreted as a Windows error code. Looking it up in WinError.h gives
<font color="green">
<font color="blue">#define</font> ERROR_INVALID_USER_BUFFER 1784L As for why this should happen: I don't know. Are you trying to pass a phonebook name? Windows 98 does not support multiple phonebooks - you must pass NULL for the first parameter.
|
|
|
|
|
Thanks Mike. I am passing NULL for the first parameter. The problem is, this call succeeds to create the dialup entry randomly. And, the remaining times, it returns this 0x6f8. Here is my code segment..
RASENTRY RasEntry;<br />
memset(&RasEntry,0,sizeof(RASENTRY));<br />
RasEntry.dwSize = sizeof(RASENTRY);<br />
<br />
DWORD dwfOptions =<br />
RASEO_RemoteDefaultGateway |<br />
RASEO_DisableLcpExtensions |<br />
RASEO_ModemLights;<br />
<br />
RasEntry.dwfNetProtocols = RASNP_Ip;<br />
RasEntry.dwFramingProtocol = RASFP_Ppp;<br />
<br />
strcpy (RasEntry.szLocalPhoneNumber,CalledParty);<br />
strcpy (RasEntry.szDeviceType,RASDT_Isdn);<br />
strcpy (RasEntry.szDeviceName,DeviceName);<br />
RasEntry.dwfOptions = dwfOptions;<br />
<br />
dwError = RasSetEntryProperties(<br />
NULL,<br />
PvcName,<br />
&RasEntry,sizeof(RASENTRY),<br />
NULL,0<br />
);
|
|
|
|
|
I need to send a file from my VC++ application
to a remote machine via ftp. I'd want to make this
automated using the win/msdos ftp application but
I don't know how. My idea is to put in my code a
line like this:
WinExec("ftp remotemaching login pwd")
Is there anyway to do this ??
Thank you in advance.
|
|
|
|
|
if your using async sockets there are lots of classes out there that already do this.. Very simple really.. There is even source code on this site so try searching before posting
|
|
|
|
|
Does anyone know of a good link dedicated for this sending file via socket.
A tutorial would be great.
Thanks in advance.
Sonork 100.41263:Anthony_Yio
|
|
|
|