|
|
If you are learning to code, then asking others to code for you is not the way to go. If you are having trouble getting started, you should put some effort into making the game yourself, and then ask when you run into problems.
|
|
|
|
|
I want to make a log with errors during the execution of my app. I'm trying to write an event to the windows Event Viewer with a VCL form application with C++ Builder XE5.
I'm using Vcl.SvcMgr.TEventLogger class.
The code in the header file is :
TEventLogger *Event;
The code in the cpp file is :
Event=new TEventLogger("MySource");
Event->LogMessage("MyMessage");
But beside my message, in the error description in the Event Viewer there is a message : "The description for Event ID 0 from source MySource cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted." . How can I remove that description and write only the message that I want? Should I be using other C++ class? I couldn't find any documentation about this class. The idea of using Event Viewer is that when the application is running on an user with restricted rights he won't be able to write to files, meaning I can't just type into a ".txt" file. If anyone else has a different idea how to make a log with errors, please share!
|
|
|
|
|
If I remember corrctly, you don't pass the message to Event Viewer directly, but you pass an application name and message id. You need a DLL that contains the texts to the ID (don't ask me in what format). And you need a specific registry key (in local machine I think) pointing the Event Viewer to the path of the DLL. We also used this approach long ago in one of our applications but aren't using it anymore because it's so complicated.
I would suggest the user needs to at least one directory where he/she has write permission. You could then enter the directory into some kind of ini file, read it on application start and write the log file into that directory.
The good thing about pessimism is, that you are always either right or pleasently surprised.
|
|
|
|
|
Hi i am writing a simple app with doc/viw architecture, now i have to buttons in the Outlook bar "Folders" and "Calendar" now i want that when restart the app the selected pane will be always the 0 -> "Folders" now i tried this:
CMFCOutlookBarTabCtrl* pOutlookBar = (CMFCOutlookBarTabCtrl*)m_wndNavigationBar.GetUnderlyingWindow();
pOutlookBar->SetActiveTab(0);
After this nothing happen. Why this?
i wait for your precious response
Giovanni
|
|
|
|
|
I want to write a adapter which can convert non static member functions to C-sytle function pointers. Here is what I got now(see the following code snippet), but the current solution is not general. I want to make
int (T::*Func)(int) accept variable arguments. but i'm stuck here? anybody can help me?
and it's necessary to make
int f() and
int display have the same signature.
The final goal is Interfacing C++ member functions with C libraries.
class StoreVals
{
int val;
public:
int display(int k) { cout << k << endl; return 0; }
};
template<class T, int (T::*Func)(int) >
class CObjectT
{
public:
static int f(int i)
{
T obj;
return (obj.*Func)(i);
}
};
void main()
{
CObjectT<StoreVals, &StoreVals::display>::f(7);
auto function_t = &CObjectT<StoreVals, &StoreVals::display>::f;
cout << typeid(function_t).name() << endl; }
|
|
|
|
|
Falconapollo wrote: The final goal is Interfacing C++ member functions with C libraries.
If you want your C++ code to call C libraries then you use
extern "C" {
...// C code and/or declarations.
}
If you want C libraries to call your C++ code then you must provide a C interface to it.
|
|
|
|
|
I have a PDF. If I use this
CString Path = GetPath("manual.pdf");
ShellExecute(0, "open", Path, NULL, NULL, SW_SHOWNORMAL);
The PDF executes. But if I then use
Path += "#page=17";
ShellExecute(0, "open", Path, NULL, NULL, SW_SHOWNORMAL);
or anything similar, I cant get the PDF to execute. I want the PDF to
execute and jump to a specific page. I found solutions, I think, where
I can execute the adobe.exe file and the path, but I dont know where
adobe.exe is located on these computers. Is there any way to execute
a PDF without knowing where the adobe executable is at?
Please, any response any one can give me will be greatly appreciated.
|
|
|
|
|
I suspect you can't open it to a specific page without knowing where Acrobat resides, but no matter - you can find that out from the registry apparently.
If you have a look at the key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AcroRd32.exe\ you can get the full-path of the exe.
From there, it's seems to be just a matter of passing that file to shell execute along with using a parameter that includes (1) the full path to the pdf doc and (2) the desired page num.
Anyhoo - here's my source: http://www.devhut.net/2013/12/04/vba-open-a-pdf-to-a-specific-page/[^]
|
|
|
|
|
The third parameter in the call to ShellExecute [^] can be used to pass the extra parameters to the called application. All you need to do is check Adobe reader for the format of those parameters.
|
|
|
|
|
Another thing to think about is whether the computers you are targetting have Adobe reader installed at all. Personally, I use SumatraPDF for viewing PDFs, but there is a Microsoft reader app (its name escapes me right now), Foxit Reader, and probably others. Each of them could have different ways to specify the page to show first.
|
|
|
|
|
What is the net value of Path ?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Quote: fatal error: Utility1.h: No such file or directory
compilation terminated.
|
|
|
|
|
The message is telling you what is wrong; what is it about "No such file or directory" that you do not understand?
Given this and your other questions, I strongly recommend you get hold of a decent reference on C programming. You cannot expect to learn it by asking repeated questions here.
|
|
|
|
|
but it is inside the directory that wat i was asking is it due to logical error or wat?
|
|
|
|
|
Are you sure that your project configuration includes that directory in its search path?
|
|
|
|
|
Quote: can anyone suggest how to convert matlab code into c code..for resampling function
|
|
|
|
|
This question is impossible to answer. Code conversion is mostly a manual task. If you want an automated conversion tool then you should use Google to find suggestions.
|
|
|
|
|
what is this catalysis MCS tool..
|
|
|
|
|
maibam debina wrote: what is this catalysis MCS tool. Sorry, I have no idea.
|
|
|
|
|
actually in matlab the function is available for resample but in c for me its hard so can u suggest some.
|
|
|
|
|
Sorry, but I do not know matlab, you would probably get better response by going to a dedicateed forum.
|
|
|
|
|
but i know u r master in c program..so leaving matlab aside do u know how to represent in c code for resampling..
|
|
|
|
|
maibam debina wrote: c code for resampling I have no idea what you mean by resampling. If you have a specific coding issue then put the details here and people will try to help you. But it is unlikely that anyone has the time to write your code, or convert from one language to another.
|
|
|
|
|
what kind of resampling (bilinear, bicubic, trilinear, spline, sinc, etc)? and for what (audio, video, statistical, etc.) ?
|
|
|
|