|
Following on from my last post about how hyper-threading made my application crash in debug, but not release, I have come to the conclusion that it is MSDev which is at fault. I thought I would let you guys know in case you have the same problem and are flummoxed (like I was).
It turned out that in the debug version of my app, it sometimes caused a GPF if an ASSERT dialog box appeared. This was due to (I assume) one hyper-thread handling the ASSERT, and another handling the TRACE message I was also writing just before the ASSERT. I don't know why but this causes a GPF in my program.
So in future I must debug my program with the affinity of MSDev (and also therefore my program) set to "CPU 0" only. No crash - a bit slower, but no crash
Hope this makes sense and that someone at least reads it
Cheerz
Tha d3m0n
|
|
|
|
|
Hi, I´ve a problem installing fonts with VC++ in my computer.
The problem is once installed any font Type1 or TrueType, think that I have to activate font. Somebody know how to activate some font with VC++?
|
|
|
|
|
Hi, I´ve a problem installing fonts in my computer.
The problem is once installed any font Type1, think that I have to activate font. Somebody know the solution?
|
|
|
|
|
Once the font file is copied to the Fonts folder (defined at HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Fonts), a value must also be added to the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts registry key. This is all handled for you by the Fonts applet in Control Panel.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi one more time,
thank you for answering. I think that my problem is about Type1 fonts. When I copy the file .pfm and .pfb in C:\..\Fonts and use Adobe Type Manager to see it, I don´t see it right, but if I deactivate the font and turn it to activating with Adobe in option Groups then I can see it. I don´t know why?
Note: I´m sorry, but my English is not very good.
Thanks.
|
|
|
|
|
I added a web service to my VC++ application. To access it from within my project I do the following code:
WeatherService::CWeatherService *ws = new WeatherService::CWeatherService();
HRESULT hr = ws->GetWeather("KNEL");
if(hr == E_FAIL)
AfxMessageBox("Unable to retrieve current weather, Invalid Station Code", MB_OKCANCEL);
It's returning an E_FAIL by the SendRequest function.
Any ideas as to what I am doing wrong? It works fine when I call it from a managed C++ application.
Thanks
|
|
|
|
|
Humm..
I tried the same by using XMethods' WeatherService (gets the weather by zipcode, found "http://www.xmethods.net/sd/2001/TemperatureService.wsdl") and it works properly. As I have no idea what web service you are consuming (no link ?), then it is just about impossible to tell if your parameters are correct.
I, however, suggest checking the parameters. It looks like you are getting the weather for a station named "KNEL", but you are not saving the result value anywhere ? Check the function parameters. I believe that the parameter should be two-fold: upon input, it specifies the station name, and upon output, it gives you the weather.
I believe that it (GetWeather) requires a BSTR value as the first parameter. If you get into a dead-end when using a BSTR, paste a link to the web service into this forum, and I'll do a quick-check on how to call it properly.. Moreover, a little more detailed code paste from the function that is calling the web service would be useful. Are you initializing COM, for example ?
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
The code for GetWeather is as follows:
public void GetWeather(string stationcode)
{
Weather weather = new Weather();
GetWeather getweather = new GetWeather();
weather = getweather.GetWeatherObject(stationcode);
}
Yes it does require a BSTR as the parameter & it does not return any value, basically all the function does is update a database with the latest weather.
It seems to be failing in the atlSoap.h file in the SendRequest function when it tries to navigate to the url, it fails in sending the message to the server os the wuestion is WHY?
|
|
|
|
|
Could you please post a link to the actual web service, or is it for private use only ?
It is nearly impossible to say anything about the actual problem before debugging it personally. It looks like that the problem in the actual service, that it is unable to handle the request. But why, then again, impossible to say. Perhaps the implementation of the web service isn't programmed properly to support VC++ callers. The 'string' variable looks like .Net Framework variable, and as such, it is not directly compatible with the BSTR variables of VC++ COM architecture.
Unfortunately, I cannot help you further until I can give a few shots at using the web service myself.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
I am looking for a script parser written in C/C++ (that will compile under VC6 at least) that meets these requirements:
1) Simple VB-like instruction set (FOR/NEXT loops, IF/THEN/ELSE blocks, DO/WHILE loops, basic variable assignments and expression parsing). The lines of the source file are supplied from a text file (no editor front-end required).
2) Supports integer, floating, and string type variables.
3) Will compile into byte-code for faster, repeated runs.
4) The parser and byte-code interpretter are in C/C++ (MFC okay) and are open-source and/or GPL'd. No special binaries or libraries needed.
5) Nice-to-have-but-not-required: function support, GOSUB/GOTO, advanced math functions (sine/cosine), custom functions (PRINT)
I looked at MyBasic on this site as a basis but don't think I can use it because it lacks requirement #3. I also followed some of the links on the MyBasic message boards but couldn't find anything that would help. This script parser/interpretter is going to be a small part of a larger project and I was hoping not to re-invent this wheel. I am looking for something that is lean, easy to drop-in (or port), and quick enough to be used in a real-time application (as in a quick interpretter).
Any of you gurus have any suggestions? Or pointers where I can look?
Thanks in advance,
Paul
|
|
|
|
|
Take a look at GoldParser, its not written in C/C++ but you should be able to use it from VC6.
|
|
|
|
|
|
Your list is terrific, but in most situations scripting languages don't cover 3) as well as you might like. The most common approach is to code as much as you can in the scripting language, and only then if profiling shows that performance is insufficient, add a hook to optimised code written in C/C++ or dare I even say it, FORTRAN if required. Both Python and Lua meet all these requirements and both can be compiled to byte code.
You're also missing a few things fromt he list.
6) It needs to be easy to use (client usability)
7) It needs to be easy to integrate (programming perspective)
8) It needs to be easy to extend
The easiest way to achieve 6) is to use a language which most people already know or can learn very quickly. Custom languages or very small parsers / languages might have some quirks that take a while to work out
7) and 8) go hand-in-hand, and I would recommend picking a language on how easy it is to use, integrate and extend from the programmers perspective as well as the clients. Writing and maintaining language bindings is not the type of code that you'll want to write every day.
There are two major classes of bindings to languages at the moment - as a precompilation step (SWIG) or as part of the compilation (boost::python and luabind). My personal preference if for the later, because it guarantees that your bindings are always upto date.
http://www.lua.org/[^]
http://luabind.sourceforge.net/[^]
http://www.python.org/[^]
http://www.boost.org/libs/python/doc/index.html[^]
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
Great suggestions! I looked into LUA and I think it will do all that I want - and more. It looks pretty well written and organized and it is always a bonus when I can learn from others.
|
|
|
|
|
Hi,
sounds easy, but it's very complicated...
I want to have a custom drawn TreeView with multiline items. The drawing of the tree works perfect but when the EditBox to edit the items text (TVN_BEGINLABELEDIT you know) is created it is - of course - singlelined.
Now I wanted to make it multiline and therefore I tried to use ModifyStyle but it didn't succeed.
The next approach was to create a CBT-Hook to hook the creation of the Edit and "smuggle" the ES_MULTILINE-Style into the windowstyle but strangely this also didn't succeed. Do you have any suggestions? the CBT-Hook is definitely called (I verified this with TRACE and Spy++).
Here's the HookProc-Code (hTree is the HWND of the tree):
LRESULT CALLBACK HookCreateWindow (int nCode, WPARAM wParam, LPARAM lParam)
{
if (nCode == HCBT_CREATEWND) {
CBT_CREATEWND* pCWnd = (CBT_CREATEWND*) lParam;
if (pCWnd->lpcs->hwndParent == hTree) {
pCWnd->lpcs->style |= ES_MULTILINE;
TRACE("\nEdit_created. HWND: 0x%x", (HWND) wParam);
}
}
return CallNextHookEx(g_hHook, nCode, wParam, lParam);
}
Thanks for your answers!
|
|
|
|
|
How are you planning on ending that editbox? Those labeledits are either aborted with esc or accepted by pressing enter. A multiline labeledit would instead create an extra line when the user hits enter. I suspect this is the reason the control is refusing to become multiline. A solution would be to overload the F2-key and pop up your own dialog with a multiline edit box, a OK button and a Cancel button.
|
|
|
|
|
You can end it with clicking outside the edit on a treeview-item (done by the treeview-control). it's a normal editbox and therefore i should be able to change the style BEFORE it receives the first message (WM_CREATE). and i don't want your solution with the dialog, i don't think that's nice :/
|
|
|
|
|
Hello all
Can any one please explain me the difference between thread and a fiber? In what circumstances we should go for a fiber? Please give me some sample code or point to URL where I can get the same.
Thanks for your help.
Hari.
|
|
|
|
|
From MSDN:
A fiber is a unit of execution that must be manually scheduled by the application. Fibers run in the context of the threads that schedule them. Each thread can schedule multiple fibers. In general, fibers do not provide advantages over a well-designed multithreaded application. Fibers are not preemptively scheduled.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Is there an API available to check if a filename is valid. At the moment the only information I can find is in the help for CreateFile() where it gives a list of invalid characters and filenames such as ./?\* or com1,con,lpt.
Systems AXIS Ltd - Software for Business ...
|
|
|
|
|
try/catch opening the file with specified filename?
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
Hello!
if you only check the string of the filename,you can check if the string have the list of "./?;'".
if you check whether the file is existent, you can use code as follow in VC6.0 :
BOOL CheckIfFileExists (LPCTSTR szFileName)
{
ASSERT( szFileName != NULL );
if( _tcslen(szFileName) == 0 ) return FALSE;
DWORD dwAttr = GetFileAttributes(szFileName);
if( dwAttr == 0xFFFFFFFF ) return FALSE;
return (dwAttr & FILE_ATTRIBUTE_DIRECTORY) == 0;
}
dupengfei
|
|
|
|
|
Question #1 : pls some give me some good pointer to smart card api's. i need them urgently or some sample project using Smart Card apis
Question #2: i am unable to use or rather say understand RegisterWindowMessage() api's.Any body pls gice me some pointer towrad it also.
thanks a lot in advance
I Think It will Work
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Alok the programmer wrote:
Question #2: i am unable to use or rather say understand RegisterWindowMessage() api's.Any body pls gice me some pointer towrad it also.
Here is some explaination from one of expert:
The RegisterWindowMessage function defines a new window message
that is guaranteed to be unique throughout the system.
So with that in minde this is one example of how to use this
special message.
If I have this code in one of my applications:
<br />
LRESULT CALLBACK MyWindowProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)<br />
{<br />
LRESULT Result;<br />
<br />
static UINT my_message = RegisterWindowMessage("my_message");<br />
<br />
if (msg == my_message)<br />
{<br />
MessageBox(hwnd, "Someone sent me my_message", "Message", MB_OK);<br />
return 0;<br />
}<br />
<br />
....<br />
<br />
return Result;<br />
}<br />
I could talk to that application from my second application
using the following code:
// Use FindWindow, EnumWindows and EnumChildWindows to get
// the hwnd of the other application
hwnd = getting_other_hwnd_left_as_excersise_function();
UINT my_message = RegisterWindowMessage("my_message");
//-- post the hwnd the special message
::PostMessage(hwnd, my_message, 0, 0);
You could also do this:
//-- broad cast a special message
::PostMessage(HWND_BROADCAST, my_message, 0, 0);
but in this case you would need to trap the message in the
second application using the following code instead:
<br />
while (GetMessage(&msg, (HWND) NULL, 0, 0)) <br />
{<br />
if (msg == my_message)<br />
{<br />
MessageBox(hwnd, "Someone sent me my_message", "Message", MB_OK);<br />
}<br />
else<br />
{<br />
TranslateMessage(&msg);<br />
DispatchMessage(&msg);<br />
}<br />
}<br />
Jussi Jumppanen
Author of: Zeus for Windows, Win32 (Brief, WordStar, Emacs) Text Editor
"The C/C++, Java, HTML, Pascal, Cobol, Fortran programmer's text editor"
Home Page: http://www.zeusedit.com
Hope this will help you.
Regards
Abhishake
|
|
|
|
|
thanks abishek
but i am still not successful in doing this.
could you pls send me the sample project for both application at email address cocokola@rediffmail.com
thanks a lot
-----------------------------
"I Think It will Work"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|