|
Grahamfff wrote:
Did think of that but it gives 0.5 for the string "0.5/pow(2, 14)".
As it should, because the '/' character terminates the conversion.
Grahamfff wrote:
Any other suggestions?
For what? What exactly are you trying to do?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
The database stores the scaling factor as a string, due to its resolution. I have arranged the scaling factor to be in a format suitable for processing by C++ code. Hence the pow(2, 14) , but apart from say arranging the output process to define something like the following:-
#define SCALING_1 0.5/pow(2,14) etc
The scaling factor is held in a array, but
#define SCALING_1 details[k].scaling // 0.5/pow(2,14)
does not work
grahamfff
|
|
|
|
|
Hello,
If your scaling factors are all in the same format, you should write a function that'll parse the string.
For exemple:
If the format would be < float ><opration>pow(< arg1 >< arg2 >) than you could write a function that will do the parsing for you.
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
I'm have a MFC project which includes a button. When pressed, i want the SaveFileDialog box to come up. I've been using the examples i've seen around online to get started but I still get errors. Here is the code I've been using:
void CProductVersionsDlg::OnButton2()
{
SaveFileDialog sdf = new SaveFileDialog();
sdf.AddExtension = true;
sdf.CheckPathExists = true;
sdf.InitialDirectory = @"C:\";
sdf.DefaultExt = "*.txt";
sdf.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*";
sdf.ShowDialog(this);
MessageBox.Show(sdf.FileName);
}
"Error:error C2065: 'SaveFileDialog' : undeclared identifier"
there are many more errors but this is the first one
I think I am missing a .h file to include.
What is the name of the file i need to include? I've been looking around online but i can't find any include files, or is it something else?
I'm running Microsoft Visual C++ 6.0 on a windows 2000 system.
|
|
|
|
|
well, SaveFileDialog is not an MFC class ...
maybe the example you looked at defined their own SaveFileDialog class to wrap the CFileDialog ( or GetSaveFileName API )
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
jet915 wrote:
SaveFileDialog sdf = new SaveFileDialog();
just call the function (SaveFileDialog is not a class).
<font style="color:blue;">void</font> CProductVersionsDlg::OnButton2() {
SaveFileDialog sdf = SaveFileDialog();
sdf.AddExtension = <font style="color:blue;">true</font>;
sdf.CheckPathExists = <font style="color:blue;">true</font>;
sdf.InitialDirectory = @<font style="color:gray;">"C:\"</font>;
sdf.DefaultExt = <font style="color:gray;">"*.txt"</font>;
sdf.Filter = <font style="color:gray;">"Text files (*.txt)|*.txt|All files (*.*)|*.*"</font>;
sdf.ShowDialog(<font style="color:blue;">this</font>);
MessageBox.Show(sdf.FileName);
}
TOXCCT >>> GEII power
|
|
|
|
|
Hi
I am writing a program which Creates Three entries into the windows registry but on some systems instead of creating the registry it locks the registry HKEY_LOCAL_MACHINE\SOFTWARE part and shows error "Access is denied" and after that it does not allow to create a entry into the registry, it seems that registry got corrupted but windows still works fine. I don't know. Is it the problem of Rights to write into the registrry or something else.This program works fine on my machine but does not works on some machines. Please help...
BOOL CGenUniqueKeyXDlg::SaveValueToRegistry(char *pcszValue)
{
DWORD dwLen = 0;
int nReturnVal;
HKEY m_hContextKey;
DWORD dwDisp;
nReturnVal = RegCreateKeyEx(HKEY_LOCAL_MACHINE , //Handle to a currently open key
REG_LOC_PATH, // Sub Key Name
0, //Reserved
NULL,
0,
KEY_WRITE,
NULL,
&m_hContextKey,
&dwDisp );
if(nReturnVal != ERROR_SUCCESS)
{
ShowRegError(nReturnVal);
return FALSE;
}
nReturnVal = RegSetValueEx(m_hContextKey, UNIQUE_KEY, 0, REG_SZ, (PBYTE)pcszValue, (_tcslen(pcszValue) + 1) * sizeof(char));
if(nReturnVal != ERROR_SUCCESS)
{
ShowRegError(nReturnVal);
return FALSE;
}
strcpy(pcszValue,m_SyncURL);//"http://Nopd/CiteCapture/MDCSync.aspx";
nReturnVal = RegSetValueEx(m_hContextKey, URL_KEY, 0, REG_SZ, (PBYTE)pcszValue, (_tcslen(pcszValue) + 1) * sizeof(char));
strcpy(pcszValue,m_Port);
nReturnVal = RegSetValueEx(m_hContextKey, COM_PORT, 0, REG_SZ, (PBYTE)pcszValue, (_tcslen(pcszValue) + 1) * sizeof(char));
RegCloseKey( m_hContextKey );
return TRUE;
}
Any input will be appreciated
Thanks
Shailesh
|
|
|
|
|
aman2006 wrote:
...but on some systems instead of creating the registry it locks the registry HKEY_LOCAL_MACHINE\SOFTWARE part and shows error "Access is denied"...
Are you sure you have 'write' permission on those particular machines? Much like you can with folders and shares, the registry can be tuned to allow/disallow certain users/groups.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
If i don't have write permission on that machine how can i write my entries in the Registry. In my code i am passing the Write Registry Permission as a parameter. Actuall i have made a installable with installed shield which runs my program at last for creating some entries. But it is corrupting the registry.... What about code is that fine or seems some problem?????
thnaks
Shailesh
|
|
|
|
|
One way to tell would be to use regedit.exe to try and write something to the same spot in the registry as the code is. Be sure and log in using the same credentials as the person running your code.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
You're asking for write access to a key under HKLM. RegCreateKeyEx() is returning access denied, which means the user doesn't have write privileges to that key. Run your code as a restricted user (not admin) and you'll see the same error.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
#include "witty-quote.h"
|
|
|
|
|
I have a file with a lot of text and I want to find some text and when I do that I need to insert some text at the same line as that text.
Exempel;
bla bla bla
hello
c++ mfc test
ok ok
And if a find hello I need to insert text after hello how do I do that?
Please help me..
|
|
|
|
|
Well, you could read the file in line-by-line and output each line to a temporary file. When you get to the line in question, output the additional text.
If, however, you can read the file in as one big blob, you can use one of the various 'find' functions (e.g., CString::Find() ) to locate the text. Write everything up to that point to a temporary file. Insert the additional text. Write the remainder of the original file to the temporary file.
In either case, when done, close both files, delete the original file, and rename the temporary file.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
So is there not away to just inser the text at that line im at?
|
|
|
|
|
What do you mean by "just?" Wouldn't one or both or my suggestions do what you require?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I have a file with text to,
and I want to find text in that file and when I fins that text I need to put in text in the same line as the text I find how can I do that? At the end of that text line.
|
|
|
|
|
You cant just insert text in the middle of a file, unless that file has been padded to receive new text.
What you have to do is rewrite the file completely. You can either:
1) Read the whole file in memory, fiddle with that memory then save back to disk (in same file ?)
2) Read the file chunk by chuck, and write each chunk in a second, temporary, file. After which, you then erase the old file and rename the one you just created.
Hope that helped.
|
|
|
|
|
Hi,
I am working on a MDI application. I derived my own view an document class and called AddDocTemplate with these classes in my CWinApp class. The views and document seem to show up when I go file/new.
But whenever I modify the document and call pDoc->UpdateAllViews(NULL) to make my views reflect the changes, I get an ASSERT failure.
void CWnd::AssertValid() const
{
...............
// should also be in the permanent or temporary handle map
CHandleMap* pMap = afxMapHWND();
ASSERT(pMap != NULL);
...............
//more code
}
Does anyone know what a permanent or temporary handle map is and how I might add one? It doesn't seem like this is in the MSDN documents as there is no reference to afxMapHWND().
Thanks in advance.
|
|
|
|
|
Whatever is causing this is unlikely to be related to permanent vs. temporary handle maps. Normally you don't add windows to handle maps yourself. You need to look at the code that is ASSERT'ing and work back from there.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
Hello,
I am using the tecnique http://www.lambdasoft.dk/comet/doc/cometautoexp.html
in order to provides custom formatting for variables in the VisualStudio debugger.
I can tell that it works very well.
What puzzles me is this.
In the code I export the function from the DLL in this way:
extern "C" {<br />
__declspec(dllexport) HRESULT WINAPI VCF_DateTimeEvaluate( DWORD dwAddress, DEBUGHELPER *pHelper, int nBase, BOOL bUniStrings, char *pResult, size_t maxlen, DWORD reserved );<br />
}<br />
But then:
dumpbin /exports AutoExp.dll
shows
_VCF_DateTimeEvaluate@28
instead than simply
VCF_DateTimeEvaluate
both by compiling with vc6 and vc70.
Other people swear that I should simply get
VCF_DateTimeEvaluate
as long as I use: extern "C" { ... }
Please note that extern "C" does something anyway, because without it I would get the mangled name:
?VCF_DateTimeEvaluate@@YGJKPAUtagDEBUGHELPER@@HHPADIK@Z
If you have the patience to answer to another related question, here it is !
If I do use a definition file, it works with vc6 by just including it in the project, as I get: VCF_DateTimeEvaluate
But with vc70 it doesn't work. Why ? What should I do different ?
|
|
|
|
|
Did you add an entry to your <project>.def file ?
<br />
DLLEXPORT<br />
<br />
VCF_DateTimeEvaluate PRIVATE<br />
Its probably auto-generating something if you dont have it in the def file.
|
|
|
|
|
Thank you very much.
At least an answer !
But it doesn't work
This is my definition file for vc70:
AutoExp.vcproj, AutoExp.cpp and AutoExp.def are all in the same directory
AutoExp.vcproj has AutoExp.cpp and AutoExp.def in itself.
<br />
<br />
Is there, maybe, some options in the project that creates problems ?<br />
<br />
Cheers,<br />
Marcello
|
|
|
|
|
How does it show in Depends.exe (which comes as a VStudio 6 tool)
How do both VC6 and VC7 dll compare in terms of exports using depends ?
|
|
|
|
|
What a cool program !
I dodn't know about it ! Thank you !
Under Depends it shows exactly as with dumpbin
vc6: it appears as VCF_DateTimeEvaluate
vc70: it appears as _VCF_DateTimeEvaluate@28
|
|
|
|
|
Hmmmmmmmmm ...
Try not putting the @1, @2 and @3 in the exports section .. see if it helps ?
|
|
|
|