Mr.M 89 Future Programmers

Thank you, you saved me, I've been trying for weeks now. It works now perfectly with your code.

Mr.M 89 Future Programmers

I'm getting an error saying the date_create class can not be found

Mr.M 89 Future Programmers

Thanks, to clarify what I meant regarding the dates is that I have a date input that shows a calendar when a user click on it to choose the date for which the register is being marked for.

Then I also have 2 time inputs one is for timein and the other is for timeout.

Let me try your code and see if it does solve the problem I've been having.

Also just one more question regarding your code, I will have to minus 1 hour from the total hour difference, do I have to use the %h - 1?

Mr.M 89 Future Programmers

Hi DW, I'm trying to mark attendance register which has the date for which that register is being marked for as well as the date which the register is actually marked on.

For Date as well as Marked Date.

I also have two time picker textboxs which one is for time in and the other is for time out.

Now I've been trying to use even time diff to get time difference between the two times provided but there are issues, basically timediff doesn't seem to work proper it also bring like 18 where it means to bring 8,there's always that first digit which confuses everything.

Another problem is that the register can be marked for anytime meaning it can also be marked for let say 20:00 to 05:00AM the next day morning also it can be marked for 02:00AM to 11:00AM which means the shift started from 2 in the morning to 11 am of the same day and so on.

Basically it can be for anytime at and day and it can even cross days now the problem is also properly calculating how many hours and minutes apart.

Does anyone know a way to tackle this as I've said I've tried using time difference but it's not working as it should.

Mr.M 89 Future Programmers

I've managed to find a solution on my own and it was something so simple, I'm not sure why C++ programmers were unable to pick this up.
Basically I need to output ComputerName using gcnew String() so it be label9->Text = gcnew String(ComputerName);

Thanks to everyone who tried hepling. I will try to find out what does this means and why it is used to better understand this.

Mr.M 89 Future Programmers

I guess a more research on this has to be made, problem is that it is hard to get the exact people who knows this and has done it before to give straight answers.

Mr.M 89 Future Programmers

NB: I've typed all these reply messages successfully using the same Chrome browser that is crashing.

Mr.M 89 Future Programmers

What I've noticed is that it seems to be clutching with keyboard auto-correct/auto-complete.

If I type a full word without pressing it from my keyboard suggestion options that shows while typing it doesn't seem to crash, but once I choose or select one auto-complete and proceed typing it freezes and crash.

Mr.M 89 Future Programmers

Hi Dani, I'm trying to reply with Chrome to test what I've noticed regarding the crash.

I've attached relevant screenshots for 3 questions.

I'm not using any plug-in
Screenshot_20250313_051351_com.android.settings.jpg

Screenshot_20250313_051213_com.android.chrome.jpg

Screenshot_20250313_051246_com.android.chrome.jpg

Mr.M 89 Future Programmers

@Dani this happens when I type a longer message than it froze and crash. I just tried testing using a different browser and it seems ok with Tor browser, the crashing happens on Chrome browser on my Android phone.

I guess the issue is only picked up by Chrome. I know chrome does give issues, I saw while I was developing a browser extension, Firefox is always the best.

As you can see I wrote this long message and it didn't crash, but if I were to type on a Chrome it would have crashed without even reaching 10 words.

Mr.M 89 Future Programmers

I'm using Microsoft Visual Studio 2010 (Visual C++ Windows Form Project).
Regarding the test yes it doe compile/build/run with no error. Here are the includes

#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <Windows.h>
#include <WinSock.h>

Here are the namespaces

using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;
    using namespace System::IO;
    using namespace System::Net;
    using namespace System::Text::RegularExpressions;
    using namespace std; // This I recently added as I was trying to solve this issue using different solutions from the internet.
rproffitt commented: I see that your system is no longer supported from what I can find. Nov 2024 was recent so while that's in play, so is the lack of code sharing. +17
Mr.M 89 Future Programmers
char ComputerName [MAX_COMPUTERNAME_LENGTH + 1];
            DWORD cbComputerName = sizeof (ComputerName);
            if(GetComputerName (ComputerName, &cbComputerName)){
                String^ pcname(ComputerName);

                label9->Text =  pcname;
            }
Mr.M 89 Future Programmers
I tried that but I get this error
     Error  14  error C2440: 'initializing' : cannot convert from 'char [16]' to 'System::String ^'

Regarding browser crashing, only with Dani its crashes on the other sites it doesn't crash 
Mr.M 89 Future Programmers

Error can't convert char to Text when I output ComputerName to label

Cannot convert parameter 1 from char[16] to system::String ^

Mr.M 89 Future Programmers

See
Screenshot_20250312_122133_com.android.chrome.jpg

Mr.M 89 Future Programmers

I don't know why DaniWeb keep on crashing whenever I try to write

Mr.M 89 Future Programmers

I'm using windows

Mr.M 89 Future Programmers

My browser keep crashing

Mr.M 89 Future Programmers

[Here is my code](Post in thread 'get computer name' https://www.tek-tips.com/threads/get-computer-name.1229373/post-4473307)

Mr.M 89 Future Programmers

Display computer name to a label

Reverend Jim commented: I don't see the point in this. -3
rproffitt commented: Too vague. Might be Linux, Pi, smart badge, web page or any number of things. Elaborate and show what you tried so far. +17
Mr.M 89 Future Programmers

@Dani, I wanted to decode it, basically @BIIM has provided something that helped me out, the problem now is that I've seen that I am facing an issue with how the data is, so now I want the end data to be like this

Content{events[{title: myeventtitleFromDatabase, start: myeventstartDateFromdatabase, end: endDateFromDatabase}]}

// The above is a basic sample but the above can have multiple objects inside events like below 

Content{events[{title: myeventtitle, start: startDate, end: endDate}, {title: myeventtitle, start: startDate, end: endDate}, {title: myeventtitle, start: startDate, end: endDate}]}

On my current code in my php file which gets the data from database is as follows

While($row = mysqli_fetch_array($myquery)){
$CalendarEvents[$i]['title'] = $row['mytitle'];
// dates are also retrieved similar and added to CalendarEvents array. 
}

$data = array(
'status' => 'success', 
'content' => $CalendarEvents
);
echo json_encode($data);

Now what I'm trying to achieve at the end is be able to display all the events associated or returned with that query at that time. The problem with my current code which works but the iasue is that it only shows 1 event because I can't do a loop inside the calendar function where I need to assign these values to.

The calendar code is a but long but

My Js code which is where I want to use this data to

$.post(/myphpfile.php),{
type: "requestType", 
param: paramValue
}, function (data, status){
//Using @BIIM's solution
Var responseData = $.parseJSON(data);
Var rdata = responseData['content'];
Var eventsx = new Array();

$.each (rdata, function(i, item){
eventsx.push({
title: rdata[i].title, …
Mr.M 89 Future Programmers

I also have to mention that the response will also be a multi-array

Mr.M 89 Future Programmers

Hi Dw, I want to get the keys and data of the php json response, heres the response I get

{"content":{"1":{"title":"Present","start":"2025,01,29","end":"2025,01,29","backgroundColor":"#f39c12","borderColor":"#f39c12"}}}

all I'm interested in starts from title.

Mr.M 89 Future Programmers

Just to indicate I've managed to work around this, and what I'm using is working 100%.

There's a reason why it uses the same id's that's because it is dynamically generated and I have almost 5 or 6 GROUPS of classes so I can't use the class grouping on this but was looking for something similar but instead of using classes I wanted to use id's.
But the approach I'm using is perfect as it uses this approach to get the element in question and find the closest tr then find the id from it.

This approach works perfect and it doesn't interfere with any other tables on other sections.

Also just to mention, the site is a one page that dynamically load elements without refreshing.

So thanks to everyone commenting but I've solved this issue.

Mr.M 89 Future Programmers

Thanks, as of using document complete I was using it and it is where I try to find the elements but it doesn't find any.

You can try it on your end with the same url and see if you will be able to fill any of the fields automatically

Mr.M 89 Future Programmers

I've managed to use an alternative, instead of this approach I've changed and used a function call onChange="Myfunction(this);" and I then reference to the dom element returned to get it option selected id.

It is now working accordingly.

Mr.M 89 Future Programmers

I have many select with the same id and I need to get their options id when that particular select is changed.

The code that I have only work or gets one select and does not work on the rest of the selects except the first one.

I've also tried using a query select all but that doesn't even work with the first one as well.

Mr.M 89 Future Programmers

What I mean is that I have a table that is dynamically generated with and each record generate the same select as you can see above.

Now the problem is that the code only work with the first table record select, from the table.

Mr.M 89 Future Programmers

Hi DW, I'm trying to get selected option id, the problem with my code is that it is only showing or returning the id of the first select only even if I click other options it doesn't return them.
Heres my code

var xid = $('#managsel option:selected').attr('id');
alert("The id is: " + xid);

Here is my select option code NB: The code is generated by php.

<select class="form-control select2" style="width: 100%;" id="managsel">
<option selected="selected">Select Department</option>
<option id="opa">Accountant</option>
<option id="opb">Training</option>
<option id="opc">Operations</option>
<option id="opd">IT</option>
</select>

Also note that the options id are generated dynamically and I don't know them beforehand.
Thank you.

Mr.M 89 Future Programmers

Greetings @Salem I haven't heard from you for a while now.

Mr.M 89 Future Programmers

information.updatesa@gmail.com

Mr.M 89 Future Programmers

@Salem here's my email informationupdatesa@gmail.com

Mr.M 89 Future Programmers

Is it really going down? In few days back I visited it and it said there's some sort of a company that is busy upgrading it and it will be up soon. This is very terrible to see such groups going down, worse thing they have so much information we find on the internet they are playing a very big part on the internet.

Mr.M 89 Future Programmers

Now getting error C2065 'width' undeclared identifier

And 'x' undeclared identifier as well as y

Mr.M 89 Future Programmers

Still this doesn't solve the error

Mr.M 89 Future Programmers

Why is Form1.h over 1000 lines long?

This is because of the the functions as well as the controls (GUI)

Why are you using C-style strncpy all over the place, and not std::string (since this is C++).

The code originally is from C

Does Form1.cpp include Form1.h?

Yes it does

I tried to send a PM to you, but it's disabled.

I also tried and I see it's not available.

An update
I've moved
extern DWORD m_dwRVersion; extern HRESULT m_hr; extern WFSVERSION m_version; extern HSERVICE m_hservice; extern HWND m_handleWind; extern LPWFSRESULT m_result;
From top by using namespace System::Drawing; to inside of a function and now it's runs. The problem is that the m_hservice has to be global because it value has to be used by other functions as now if I just add it, it returns invalid service error which is error -22.

If I put back the m_hservice I get the error unsigned short.

Mr.M 89 Future Programmers

This is not to cover the extension tracks, I've seen a lot of people being hacked through this, and it's does happen but making sure there's no possible way for someone to view someones credentials. An extension can do many different harmful things without even needing to hide it tracks which an ordinary user may not be aware of.
Many people are also not aware of this as well, can't file this as a bug because on the other side it's a good feature especially if you are developing as you can see exactly what's happening and how it's happening on your website

Mr.M 89 Future Programmers

Here's my build log

1>------ Rebuild All started: Project: myprojectname, Configuration: Debug Win32 ------
1>  stdafx.cpp
1>  AssemblyInfo.cpp
1>  Form1.cpp
1>  Form2.cpp
1>  home1.cpp
1>c:\users\mypcname\documents\visual studio 2010\projects\myprojectname\myprojectname\Form1.h(13): warning C4005: 'EXIT_FAILURE' : macro redefinition
1>          C:\Program Files\Microsoft Visual Studio 10.0\VC\include\stdlib.h(46) : see previous definition of 'EXIT_FAILURE'
1>c:\users\mypcname\documents\visual studio 2010\projects\myprojectname\myprojectname\Form1.h(711): warning C4101: 'WfsVersion' : unreferenced local variable
1>c:\users\mypcname\documents\visual studio 2010\projects\myprojectname\myprojectname\Form1.h(709): warning C4101: 'data' : unreferenced local variable
1>c:\users\mypcname\documents\visual studio 2010\projects\myprojectname\myprojectname\Form1.h(846): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>          C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(188) : see declaration of 'strncpy'
1>c:\users\mypcname\documents\visual studio 2010\projects\myprojectname\myprojectname\Form1.h(905): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>          C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(188) : see declaration of 'strncpy'
1>c:\users\mypcname\documents\visual studio 2010\projects\myprojectname\myprojectname\Form1.h(940): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>          C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(188) : see declaration of 'strncpy'
1>c:\users\mypcname\documents\visual studio 2010\projects\myprojectname\myprojectname\Form1.h(975): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>          C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(188) : see declaration of 'strncpy'
1>c:\users\mypcname\documents\visual studio 2010\projects\myprojectname\myprojectname\Form1.h(1010): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>          C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(188) …
Mr.M 89 Future Programmers

No one know a fix or a solution to this problem?

Mr.M 89 Future Programmers

The file is there and it also includes Form1.h

Mr.M 89 Future Programmers

What changes? You mean just how our traffic/activity has decreased over the years?

Yes, but I think there can be something that can be done to increase the traffic because you find now that if you have that few minutes spare time and login to see if there are any questions of interest or new but find mostly old questions and logout after browsing around.

But the change was needed but I think there can be something we as the community members can do to regain the traffic as much as it may take some time but eventually we will get there again.

My friend Jim Boykin isn’t active on DaniWeb, I’m afraid. I’m pretty sure he’s a member, but not an active one.

Ok, I thought you were talking about Reverend Jim.

Mr.M 89 Future Programmers

Oops when I uncomment the code as I've commented it out while I was having that error so that I can continue with the other development on the Form now I get
error LNK2020: unresolved token (0A0000DF) "unsigned short MyprojectName::m_hservice"

Mr.M 89 Future Programmers

I was very much active back then on Expert-Exchange, Stackoverflow, but I was more into DaniWeb before the changes but I was and still not a fan of Stackoverflow because of its limitations when you try solving problems so that's the reason why I ended up focusing here and on EE then EE started blocking with that EE certificate I don't really understand what they were planning exactly because it locked out many people preventing them from accessing the forum. But now mine has been sorted as well just that I've lost interest in it.

Owh @Dani,are you referring to the one and only Jim that we have here at Dw?

Mr.M 89 Future Programmers

Thank you so much, I would not have figured that out. You are a champ.

Mr.M 89 Future Programmers

Hi DW, I'm trying to automate using NAVIS, I tried using post method simulating how it does on a web browser but I get error 678 then now I'm trying to access it using vb.net web browser.It does load but the issue is that I can't set the input elements value automatically using this code
WebBrowser1.Document.GetElementById("iNfYj").SetAttribute("value", "Testing")
this line of code is inside a button on my form.
Heres how I load the page on form load

Private Sub frmMenu_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        WebBrowser1.Navigate("http://41.162.72.195:9080/apex/capHomeView.zul")
    End Sub
Mr.M 89 Future Programmers

I did try moving

DWORD m_dwRVersion;
HRESULT m_hr;
WFSVERSION m_version;
HSERVICE m_hservice;
HWND m_handleWind;
LPWFSRESULT m_result;

From Form1.h to Form1.cpp but when I do that I get this error error C2146: syntax error : missing ';' before identifier 'm_dwRVersion'

Mr.M 89 Future Programmers

@WilliamOG This variable is not declared anywhere else except on Form1 where it is giving me problems.
The issue seems to be with

DWORD m_dwRVersion;
HRESULT m_hr;
WFSVERSION m_version;
HSERVICE m_hservice;
HWND m_handleWind;
LPWFSRESULT m_result;

@SaleM the code itself doesn't have error because I can execute Form1 without having it being called or started by another Form. The problem starts when I want Form1 to be started by another form.

To clear a picture for you, this problem shows even if you create a new form and only include form1 so that you will be able to Form1 ^ form1 = gcnew Form1; form1->Show();
But once you include form1 this error will show and remember this is a new form with no such code or declaration but as soon as you include form1 it will produce this error.

Mr.M 89 Future Programmers

Hi DW, I'm having an issue here, I have 3 forms namely start.h,home,Form1 in their order of execution, the problem starts when I include Form 1 to any of these forms then I get LNK2005 'unsigned short MyprojectName::m_hservice' (?m_hservice@MyprojectName@@$$Q3GA) Already defined in home.obj

NB these forms are completely different, the first one which is start.h only let the user to click a button then show home which home is a password form when a user keys the correct credentials then it should now show Form1 but when I #include 'Form1.h' to home.hI get this error but hoeme.h doesn't have m_hservice at all being defined by myself so I don't know where it's taking it from because I never did that and it's not there as well.

Anyone who knows how I can solve this problem?

Mr.M 89 Future Programmers

Thanks but it gives me an error hwnd undeclared identifier

Mr.M 89 Future Programmers

Greetings, I'm having an issue, I want to set my form to display at the very top right hand side corner of a screen, I've achieved this in vb.net using this code

Location = New Point(Screen.PrimaryScreen.WorkingArea.Width - Width, 0)

Does anyone know how I can do this in VC++?